View Source Ash.Query.Aggregate (ash v3.1.4)
Represents an aggregated association value
Summary
Functions
Create a new aggregate, used with Query.aggregate
or Ash.aggregate
Types
@type kind() ::
:custom | :exists | :avg | :min | :max | :list | :sum | :first | :count
@type t() :: %Ash.Query.Aggregate{ agg_name: term(), authorize?: term(), constraints: term(), context: term(), default_value: term(), field: term(), filterable?: term(), implementation: term(), include_nil?: term(), join_filters: term(), kind: term(), load: term(), name: term(), query: term(), read_action: term(), relationship_path: term(), resource: term(), sensitive?: term(), sortable?: term(), type: term(), uniq?: term() }
Functions
Create a new aggregate, used with Query.aggregate
or Ash.aggregate
Options:
:path
(list ofatom/0
) - The relationship path to aggregate over. Only used when adding aggregates to a query.:query
(term/0
) - A base query to use for the aggregate, or a keyword list to be passed toAsh.Query.build/2
:field
(atom/0
) - The field to use for the aggregate. Not necessary for all aggregate types.:default
(term/0
) - A default value to use for the aggregate if it returnsnil
.:filterable?
(boolean/0
) - Whether or not this aggregate may be used in filters. The default value istrue
.:sortable?
(boolean/0
) - Whether or not this aggregate may be used in sorts. The default value istrue
.:type
(term/0
) - A type to use for the aggregate.:constraints
(term/0
) - Type constraints to use for the aggregate.:implementation
(term/0
) - The implementation for any custom aggregates.:read_action
(atom/0
) - The read action to use for the aggregate, defaults to the primary read action.:uniq?
(boolean/0
) - Whether or not to only consider unique values. Only relevant forcount
andlist
aggregates. The default value isfalse
.:include_nil?
(boolean/0
) - Whether or not to includenil
values in the aggregate. Only relevant forlist
andfirst
aggregates. The default value isfalse
.:join_filters
(map of one or a list ofatom/0
keys andterm/0
values) - A map of relationship paths (an atom or list of atoms), to an expression to apply when fetching the aggregate data. See the aggregates guide for more. The default value is%{}
.:sensitive?
(boolean/0
) - Whether or not references to this aggregate will be considered sensitive The default value isfalse
.:authorize?
(boolean/0
) - Whether or not the aggregate query should authorize based on the target action.
SeeAsh.Resource.Dsl.aggregates.count
for more information. The default value istrue
.