How to ensure all db operations in a same transaction? #9458
Answered
by
sl1depengwyn
formingform
asked this question in
Q&A
-
I tried to implement a fetcher to filter my contract events, and I'll import the events to db like this:
But, before to import events to db, I'll do something else and update my business tables, so, how can I ensure "import events" and "update business tables" in a same transaction? Thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
sl1depengwyn
Feb 29, 2024
Replies: 1 comment 1 reply
-
In blockscout we do it like this https://hexdocs.pm/ecto/Ecto.Multi.html |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
formingform
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In blockscout we do it like this https://hexdocs.pm/ecto/Ecto.Multi.html