Elex.Variable (Elex v0.2.1)

View Source

A named value with a type used during expression validation and evaluation.

Variables are stored on a Elex.Context and referenced in expressions by name. The :type field drives type checking in Elex.Validator; the :value field is returned by Elex.Evaluator.

Fields

  • :type - One of :decimal, :boolean, :string, nil, or :unknown
  • :value - The runtime value (Decimal.t(), boolean(), String.t(), etc.)

Examples

%Elex.Variable{value: Decimal.new("3.14"), type: :decimal}
%Elex.Variable{value: true, type: :boolean}
%Elex.Variable{value: "hello", type: :string}

Use Elex.add_variable/3 to infer the type from a value.

Summary

Types

t()

A variable with a known type and runtime value.

Types

t()

@type t() :: %Elex.Variable{type: atom(), value: any()}

A variable with a known type and runtime value.