ash v1.24.1 Ash.Query.Function behaviour View Source

A function is a predicate with an arguments list.

For more information on being a predicate, see Ash.Filter.Predicate. Most of the complexities are there. A function must meet both behaviours.

Link to this section Summary

Functions

Attaches the appropiate suffix to refer to an ordinal number, e.g 1 -> "1st"

Callbacks

The number and types of arguments supported.

Link to this section Types

Specs

arg() :: :ref | :term | {:options, Keyword.t()}

Link to this section Functions

Attaches the appropiate suffix to refer to an ordinal number, e.g 1 -> "1st"

Link to this section Callbacks

Specs

args() :: [arg()]

The number and types of arguments supported.

Currently supports three values: :ref, :term, and {:options, schema}.

  • :ref - a column/relationship path reference. Will be an instance of Ash.Query.Ref
  • :term - any value. No type validation is currently supported except for what is listed here, so it must be done in the new/1 function
  • {:options, keys} - Only the last arg may be options, and keys is a list of atoms for which options are accepted

Specs

new([term()]) :: {:ok, term()}