diff --git a/lib/www/server/lib/db/connection.js b/lib/www/server/lib/db/connection.js index 2672f5c..adf4d21 100644 --- a/lib/www/server/lib/db/connection.js +++ b/lib/www/server/lib/db/connection.js @@ -14,6 +14,21 @@ numericTypeOIDs.forEach(oid => { // types.setTypeParser(oid, function (v) { return JSON.parse(v); }); // }) -module.exports = { - pool +const transaction = { + async begin (client) { + return await client.query("BEGIN;"); + }, + + async commit (client) { + return await client.query("COMMIT;"); + }, + + async rollback (client) { + return await client.query("ROLLBACK;"); + } +}; + +module.exports = { + pool, + transaction, };