ash v1.24.1 Ash.Resource.Dsl.UuidPrimaryKey View Source

Link to this section Summary

Functions

Declares a non writable, non nil, primary key column of type uuid, which defaults to Ash.uuid/0

Link to this section Functions

Link to this macro

uuid_primary_key(name, opts \\ [])

View Source (macro)

Declares a non writable, non nil, primary key column of type uuid, which defaults to Ash.uuid/0

Examples

uuid_primary_key :id

Arguments

  • :name - The name of the attribute.

Options

  • :type - The type of the attribute. The default value is Ash.Type.UUID.

  • :constraints - Constraints to provide to the type when casting the value. See the type's documentation for more information.

  • :primary_key? - Whether or not the attribute is part of the primary key (one or more fields that uniquely identify a resource) The default value is true.

  • :allow_nil? - Whether or not the attribute can be set to nil The default value is false.

  • :generated? - Whether or not the value may be generated by the data layer. If it is, the data layer will know to read the value back after writing. The default value is false.

  • :writable? - Whether or not the value can be written to The default value is false.

  • :private? - Whether or not the attribute will appear in any interfaces created off of this resource, e.g AshJsonApi and AshGraphql The default value is false.

  • :update_default - A zero argument function, an {mod, fun, args} triple or a value. If no value is provided for the attribute on update, this value is used.

  • :default - A zero argument function, an {mod, fun, args} triple or a value. If no value is provided for the attribute on create, this value is used. The default value is &Ash.uuid/0.

  • :description - An optional description for the attribute