mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:37: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); });
|
// types.setTypeParser(oid, function (v) { return JSON.parse(v); });
|
||||||
// })
|
// })
|
||||||
|
|
||||||
module.exports = {
|
const transaction = {
|
||||||
pool
|
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