View Source Ash.Query.Operator behaviour (ash v2.14.17)

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.

Summary

Callbacks

Create a new predicate. There are various return types possible

The implementation of the inspect protocol.

Functions

Create a new operator. Pass the module and the left and right values

Callbacks

@callback 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
@callback to_string(
  struct(),
  Inspect.Opts.t()
) :: term()

The implementation of the inspect protocol.

If not defined, it will be inferred

Functions

Create a new operator. Pass the module and the left and right values