ash v0.10.0 Ash.Dsl.UpdateTimestamp View Source

Link to this section Summary

Functions

Declares a non-writable attribute with a create and update default of &DateTime.utc_now/0

Link to this section Functions

Link to this macro

update_timestamp(name, opts \\ [])

View Source (macro)

Declares a non-writable attribute with a create and update default of &DateTime.utc_now/0

Examples

update_timestamp :inserted_at

Arguments

  • :name - The name of the attribute.

Options

  • :type - false The type of the attribute. The default value is :utc_datetime.

  • :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 false.

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

  • :generated? - Whether or not the value may be generated by the data layer The default value is false.

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

  • :update_default - false A zero argument function, an {mod, fun, args} triple or {:constant, value}. If no value is provided for the attribute on update, this value is used. The default value is &DateTime.utc_now/0.

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