Ash.Type.Tuple (ash v3.27.8)

Copy Markdown View Source

Represents a tuple stored in the data layer as a map.

A builtin type that can be referenced via :tuple

  • :fields (keyword/0) - Required. The types of the fields in the tuple, and their constraints.
    This type is stored as a map under the hood, keyed by the field name, and is represented in memory as a tuple.
    Example constraints:
    constraints: fields:  [
                  amount: [
                    type: :integer,
                    description: "The amount of the transaction",
                    constraints: [
                      max: 10
                    ]
                  ],
                  currency: [
                    type: :string,
                    allow_nil?: false,
                    description: "The currency code of the transaction",
                    constraints: [
                      max_length: 3
                    ]
                  ]
                ]  
    allow_nil? is true by default.
    • :type (an Ash.Type) - Required.

    • :allow_nil? (boolean/0) - The default value is true.

    • :description (String.t/0)

    • :constraints (keyword/0) - The default value is [].

    • :init? (boolean/0) - If false, the field's type constraints are not initialised at compile time. Allows for recursive tuple fields. The default value is true.

Summary

Functions

handle_change?()

prepare_change?()