#
View Source Ash.Query.Operator behaviour (ash v2.4.22)

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

## Callbacks

new(term, term)

Create a new predicate. There are various return types possible

to_string( struct, t )

The implementation of the inspect protocol.

## Functions

new(mod, left, right)

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

operator_symbols()
operators()

# Link to this section Callbacks

Link to this callback

# new(term, term)

View Source

    @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

Link to this callback

# to_string( struct, t )

View Source

    @callback to_string(
      struct(),
      Inspect.Opts.t()
    ) :: term()

The implementation of the inspect protocol.

If not defined, it will be inferred

# Link to this section Functions

Link to this function

# new(mod, left, right)

View Source

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

Link to this function

# operator_symbols()

View Source
Link to this function

# operators()

View Source