View Source Ash.Resource.Preparation.Builtins (ash v1.53.2)
Builtin query preparations
Link to this section Summary
Functions
Passes the given keyword list to Ash.Query.build/2
with the query being prepared.
Merges the given query context. If an MFA is provided, it will be called with the query.
Link to this section Functions
Passes the given keyword list to Ash.Query.build/2
with the query being prepared.
This allows declaring simple query modifications in-line. For more complicated query modifications, use a custom preparation.
For example:
read :top_ten_songs do
prepare build(sort: [song_rank: :desc], limit: 10)
end
@spec set_context(map() | (Ash.Query.t() -> mfa())) :: {atom(), Keyword.t()}
Merges the given query context. If an MFA is provided, it will be called with the query.
The MFA should return {:ok, context_to_be_merged}
or {:error, term}