Ash.Calculation behaviour (ash v1.47.6) View Source

The behaviour for a calculation module

Use select/2 to apply a select statement when the calculation is loaded. This does not apply in the case that you are loading on existing resources using MyApi.load. It also doesn't apply when the calculation is used in a filter or sort, because it is not necessary to select fields to power filters done in the data layer.

Link to this section Summary

Link to this section Callbacks

Link to this callback

calculate(list, arg2, map)

View Source (optional)

Specs

calculate([Ash.Resource.record()], Keyword.t(), map()) ::
  {:ok, [term()]} | [term()] | {:error, term()}

Specs

describe(Keyword.t()) :: String.t()
Link to this callback

expression(arg1, map)

View Source (optional)

Specs

expression(Keyword.t(), map()) :: any()

Specs

init(Keyword.t()) :: {:ok, Keyword.t()} | {:error, term()}

Specs

load(Ash.Query.t(), Keyword.t(), map()) :: Ash.Query.t()

Specs

select(Ash.Query.t(), Keyword.t(), map()) :: [atom()]