I am trying to create a code interface that is powered by a query that will grow and evolve over time.
To just play around with Ash queries I tried to start easy and return all the resources where the attribute
This code works:
require Ash.Query Red.Practice.Card |> Ash.Query.filter(word == "red") |> Red.Practice.read!()
But the above is not a nice code interface.
actions I have tried to create the following:
read :next do # filter(is_nil([:retry_at])) # filter(expr([:retry_at] == "NULL")) # filter([:word] == "red") end
None of those worked.
I am clearly guessing here and not finding any examples in the documentation. I was looking here but it does not seem like any of these examples are for using inside of a resource. It looks like it is meant for building queries like I already have working.
Ultimately I need a
next action that filters to
actor: user, if there is a resource with a retry_at in the past, return the one with the oldest
retry_at date. If not, return a resource with
retry_at: nil and the oldest
created_at. I don’t need that code written for me, but which documentation or example should I be looking at for composing a query inside of a resource action and exposing it through a code interface.