ecto queries in liveviews and controllers? discuss. 🍿 #ElixirLang #phoenix #code
2 reposts17 likes
one thing i may do differently in the future is test the presence of whatever components i'm using, then make assertions on the contents of those components in separate test modules. today, most of the lv tests i've written are doing way too much. this could be a six-vs-half-dozen problem in the end
I actually posted about this recently, just not here. genserver.social/notice/Ap4or...
It depends 🤷 Mostly no. For tiny simple things, sure. As a way of growing into something more complex, fine. And maybe for a pure read-model query in a CQRS like application. In all other cases, probably not the best idea. Adding some structure will not be a bad thing. And it's often easier to test.
Here is another way for a single query context function, you can basically copy paste this snippet and adapt the filters. elixirforum.com/t/how-to-str...