AshReports.Variable (ash_reports v0.1.0)
Represents a variable that accumulates values during report execution.
Variables can perform calculations like sum, count, average, etc., and can be reset at different scopes (detail, group, page, or report level).
Summary
Functions
Calculates the next value for the variable based on its type.
Returns the default initial value for a variable type.
Gets the display value for the variable (handles average calculation).
Creates a new Variable struct with the given name and options.
Checks if this variable should reset when the given scope changes.
Types
@type reset_scope() :: :detail | :group | :page | :report
@type t() :: %AshReports.Variable{ expression: Ash.Expr.t(), initial_value: any(), name: atom(), reset_group: pos_integer() | nil, reset_on: reset_scope(), type: variable_type() }
@type variable_type() :: :sum | :count | :average | :min | :max | :custom
Functions
Calculates the next value for the variable based on its type.
@spec default_initial_value(variable_type()) :: any()
Returns the default initial value for a variable type.
Gets the display value for the variable (handles average calculation).
Creates a new Variable struct with the given name and options.
@spec should_reset?(t(), reset_scope(), pos_integer() | nil) :: boolean()
Checks if this variable should reset when the given scope changes.