node-postgres
node-postgres copied to clipboard
Add pg-transaction module
I'm taking over the old pg-transaction module, and turning it into a simpler async/await affair. I basically write this same utility in every project I do, so thought it'd be helpful. Pass the transaction function a connected client or an instance of a pool and it will call back with the client (or one checked out from the pool) already within a BEGIN block. If your async callback doesn't throw, it will COMMIT after, and if it does throw, it will ROLLBACK. It also releases the client back to the pool regardless of if the your async callback function throws or not.
~todo: add docs~ done
Deploying node-postgres with
Cloudflare Pages
| Latest commit: |
bc627be
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e885314f.node-postgres.pages.dev |
| Branch Preview URL: | https://bmc-pg-transaction-2.node-postgres.pages.dev |