Add transaction utility functions to DB interface

This commit is contained in:
D. Berge
2020-08-16 10:15:44 +02:00
parent 2bfa340b52
commit dc1e08b452

View File

@@ -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,
};