Ash.Query.Operator behaviour (ash v1.37.2) 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

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

new(term(), term()) ::
  {:ok, term(), term()} | {:ok, term()} | {:known, boolean()} | {:error, term()}

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.g 1 == 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