ash v0.1.1 Ash.Resource.Attributes View Source
A DSL component for declaring attributes
Attributes are fields on an instance of a resource. The two required pieces of knowledge are the field name, and the type.
Link to this section Summary
Functions
Declares an attribute on the resource
Link to this section Functions
Declares an attribute on the resource
Type can be either a built in type (see Ash.Type) for more, or a module
implementing the Ash.Type behaviour.
Opts
primary_key?(boolean): Whether this field is, or is part of, the primary key of a resource. - Default: falsedefault({:function, 0} | {module, atom} | {exactly(:constant), any}): A one argument function that returns a default value, an mfa that does the same, or a raw value via specifying{:constant, value}.
Examples
attribute :first_name, :string, primary_key?: true