Ash.Type.Range (ash v3.32.1)

Copy Markdown View Source

A continuous range of values of an inner type — the value type for temporal period columns (e.g valid_at).

Parametrized by its inner type via constraints (one of :date, :integer, :naive_datetime, :datetime):

attribute :valid_at, Ash.Type.Range, constraints: [inner_type: :datetime]

Casts to/from an Ash.Range struct. The data layer maps it to a native range type — ash_postgres renders :datetime as tstzrange, :date as daterange, :naive_datetime as tsrange, :integer as int8range.

Constraints

  • :inner_type - Required. The type of the range's bounds. One of [:date, :integer, :naive_datetime, :datetime]. Valid values are :date, :integer, :naive_datetime, :datetime

  • :inner_constraints (keyword/0) - Constraints applied to each bound, passed through to the inner type. The default value is [].

  • :lower (keyword/0) - Constraints on the range's lower bound. The default value is [].

    • :required? (boolean/0) - The range must have a lower bound. The default value is false.

    • :inclusive? (boolean/0) - The lower bound, where there is one, must include its own value.

  • :upper (keyword/0) - Constraints on the range's upper bound. The default value is [].

    • :required? (boolean/0) - The range must have an upper bound. The default value is false.

    • :inclusive? (boolean/0) - The upper bound, where there is one, must include its own value.

  • :allow_empty? (boolean/0) - If false, a range containing no points is refused. The default value is false.

Summary

Functions

handle_change?()

prepare_change?()