View Source Ash.Resource.Preparation.Builtins (ash v2.5.16)

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.

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.

To see the available options, see Ash.Query.build/2

examples

Examples

prepare build(sort: [song_rank: :desc], limit: 10)
prepare build(load: [:friends])
@spec set_context(context :: map() | mfa()) :: Ash.Resource.Preparation.ref()

Merges the given query context.

If an MFA is provided, it will be called with the changeset. The MFA should return {:ok, context_to_be_merged} or {:error, term}

examples

Examples

change set_context(%{something_used_internally: true})
change set_context({MyApp.Context, :set_context, []})