mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 13:07:08 +00:00
Add transaction utility functions to DB interface
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user