Skip to content
Discussion options

You must be logged in to vote

You can use transaction with pool.

const result = await dbpool.acquire((connection)=>{
  await connection.startTransaction();
  // Do what ever you want. 
);

Transaction will be committed on successful execution of the arrow function. If any error occurs, transaction will be rolled back automatically. Alternatively you can call connection.commit() or connection.rollback() any time.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by erayhanoglu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants