View Source Ash.Resource.Calculation behaviour (ash v3.3.3)
The behaviour for defining a module calculation, and the struct for storing a defined calculation.
Summary
Types
@type opts() :: Keyword.t()
@type t() :: %Ash.Resource.Calculation{ allow_nil?: boolean(), arguments: [Ash.Resource.Calculation.Argument.t()], calculation: module() | {module(), keyword()}, constraints: keyword(), description: nil | String.t(), filterable?: boolean(), load: keyword(), name: atom(), public?: boolean(), sensitive?: term(), sortable?: boolean(), type: nil | Ash.Type.t() }
Callbacks
@callback calculate( records :: [Ash.Resource.record()], opts :: opts(), context :: Ash.Resource.Calculation.Context.t() ) :: {:ok, [term()]} | [term()] | {:error, term()} | :unknown
@callback expression(opts :: opts(), context :: Ash.Resource.Calculation.Context.t()) :: any()
@callback has_expression?() :: boolean()
@callback load( query :: Ash.Query.t(), opts :: opts(), context :: Ash.Resource.Calculation.Context.t() ) :: atom() | [atom()] | Keyword.t()
@callback strict_loads?() :: boolean()