Filtering by/selecting calculations when working with direct ecto queries
I have a use case where I'm needing to reach for Ecto directly. I'm trying to see if it's possible to filter by a calculation (or even just select it) when doing this. I can of course duplicate my calculation logic, but looking for a way to avoid that if possible 😅
5 Replies
Solution
Nope 😄
I mean, kind of
Its not fun to make happen though
gotcha
Probably not worth it in my use case I'm gonna assume 😅
You could potentially get them selected and then subquery and then filter on them for example
Probably not, but it depends on how horrible it would be without it 😆
Not really all that bad, just felt like the sort of thing I had to at least attempt before just duplicating code 😅