ash v1.15.0 Ash.Query.Operator behaviour View Source
An operator is a predicate with a left
and a right
For more information on being a predicate, see Ash.Filter.Predicate
. Most of the complexities
are there. An operator must meet both behaviours.
Link to this section Summary
Functions
Create a new operator. Pass the module and the left and right values
Callbacks
Return true or false if the left and right match the operator.
Create a new predicate. There are various return types possible
The implementation of the inspect protocol.
Link to this section Functions
Create a new operator. Pass the module and the left and right values
Link to this section Callbacks
Specs
Return true or false if the left and right match the operator.
Any references are resolved before being passed in.
If this is not defined, it will be assumed that data does not match.
Specs
new(term(), term()) :: {:ok, term(), term()} | {:ok, term()} | {:known, boolean()} | {:error, Ash.error()}
Create a new predicate. There are various return types possible:
{:ok, left, right}
- Return the left/right values of the operator{:ok, operator}
- Return the operator itself, this or the one above are acceptable{:known, boolean}
- If the value is already known, e.g1 == 1
{:error, error}
- If there was an error creating the operator
Specs
to_string(struct(), Inspect.Opts.t()) :: term()
The implementation of the inspect protocol.
If not defined, it will be inferred