Replies: 2 comments 5 replies
-
Why are you executing For transactions, you can simply pass connection context |
Beta Was this translation helpful? Give feedback.
-
You initiate a transaction, and then pass its connection context into the service. |
Beta Was this translation helpful? Give feedback.
-
Hi
I have a utils file for all db related operations where I defined db that makes all the queries
I defined generic insert, select and update queries and I call them from the services (route/controller/service), for example
All is fine but now I want to execute several queries inside a transaction. I saw that I should do
db.tx(async t => {
but I don't have access to db from the service. Also, the generic methods are using db to execute the queries and I needt
object to do it.I'm a bit confused about if and how I can use transactions, does anyone have any pointers for me to look at?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions