ash v1.11.0 Ash.Query View Source
Utilties around constructing/manipulating ash queries.
Ash queries are used for read actions and side loads, and ultimately map to queries to a resource's data layer.
Link to this section Summary
Functions
Adds an aggregation to the query.
Adds a calculation to the query.
Limit the results returned from the query
Create a new query.
Skip the first n records
Set the query's api, and any side loaded query's api
Link to this section Types
Link to this section Functions
Specs
aggregate( t() | Ash.resource(), atom(), Ash.aggregate_kind(), atom() | [atom()], Ash.query() | nil ) :: t()
Adds an aggregation to the query.
Aggregations are made available on the aggregates
field of the records returned
The only aggregate available currently is a count
aggregate. They filter option accepts
either a filter or a keyword list of options to supply to build a limiting query for that aggregate.
However, currently only filters are accepted.
Specs
build(Ash.resource(), Ash.api() | nil, Keyword.t()) :: t()
Adds a calculation to the query.
Calculations are made available on the calculations
field of the records returned
The module_and_opts
argument accepts either a module
or a {module, opts}
. For more information
on what that module should look like, see Ash.Calculation
.
More features for calculations, like passing anonymous functions, will be supported in the future.
Specs
filter(t() | Ash.resource(), nil | false | Ash.filter() | Keyword.t()) :: t()
Specs
limit(t() | Ash.resource(), nil | integer()) :: t()
Limit the results returned from the query
Specs
Create a new query.
Specs
offset(t() | Ash.resource(), nil | integer()) :: t()
Skip the first n records
Specs
Set the query's api, and any side loaded query's api
Specs
Specs
sort(t() | Ash.resource(), Ash.sort()) :: t()
Specs
unset(Ash.resource() | t(), atom() | [atom()]) :: t()