tap349
Ecto.Multi without transaction
Hi all!
All examples I’ve seen so far wrap Ecto.Multi in transaction to execute - is it possible to run it outside of transaction? That is to use something else (not Repo.transaction) to execute it?
I find error handling provided by Ecto.Multi to be useful but don’t need to rollback previous changes in case further operations fail.
Thanks
Marked As Solved
hubertlepicki
I assume you are familiar with Elixir’s with syntax?
Also Liked
anthonator
I really like Ecto.Multi for composability purposes outside of its intended use case. I think there might be some momentum in the community around this as I’ve heard someone is working on pulling Multi out of Ecto and making it more generic.
I agree with @hubertlepicki. The with syntax is a good alternative. I just went through our code base and replaced a bunch of Ecto.Multi’s with with statements. I’ve recently been down this road and I think using with statements is a good approach.







