How to create a transaction outside of callback function?

Specifically for postgres Example Usage:
const tx = db.transaction()
try {
tx.insert(...)
tx.update(...)
...
await tx.commit()
} catch {
await tx.rollback()
}
const tx = db.transaction()
try {
tx.insert(...)
tx.update(...)
...
await tx.commit()
} catch {
await tx.rollback()
}
Reiterating: https://discord.com/channels/1043890932593987624/1170095630711017503/1171878101978988645 Use-case: https://discord.com/channels/1043890932593987624/1171123409653071965
1 Reply
Angelelz
Angelelz12mo ago
Maybe you can promisify it? I'm not really sure, but I do know that the callback gets called in a transaction context
Want results from more Discord servers?
Add your server