knex / knex

A query builder for PostgreSQL, MySQL, CockroachDB, SQL Server, SQLite3 and Oracle, designed to be flexible, portable, and fun to use.
https://knexjs.org/
MIT License
19.23k stars 2.12k forks source link

Async Await Example in Transactions #5879

Open adarshmadrecha opened 5 years ago

adarshmadrecha commented 5 years ago

Dear Contributors, It would be amazing to have Async-Await example in the transaction section

Example Code: https://github.com/tgriesser/knex/issues/3309#issuecomment-509613834

This will also clear out the confusion on what is the best way to write Async-Await style code when using transaction. https://github.com/tgriesser/knex/issues/3309 also has some discussion on this.

elhigu commented 5 years ago

Generally speaking using explicit commit / rollback (the linked comment) is not the best way, but yeah I think we could start using async / await in documentation.