Ash Resources with Ecto Multi

I'm using commanded, an event sourcing library for a learning project I'm on. Making read model projections in commanded work via a function that returns an ecto multi. How can I use Ash resources with Ecto multis?
4 Replies
ZachDaniel
ZachDaniel3y ago
Generally speaking, it should "just work" to use Ash resource calls within an ecto multi's run function i.e
Ecto.Multi.run(multi, :create, fn _repo, _stuff ->
<create_ash_record>
end)
Ecto.Multi.run(multi, :create, fn _repo, _stuff ->
<create_ash_record>
end)
kingdomcoder
kingdomcoderOP3y ago
I'll try that. I wasn't sure if that's the way to go. Thanks
ZachDaniel
ZachDaniel3y ago
👍 There is also some interesting work being done on integrating Ash with commanded that might pan out into a pretty neat integration at some point 😄 but its not ready yet unfrotunately
kingdomcoder
kingdomcoderOP3y ago
I can't wait! They seem to be a match made in heaven for creating powerful, complex software that you can still wrap your mind around

Did you find this page helpful?