ash v0.10.0 Ash.Dsl View Source

The built in resource DSL. The three core DSL components of a resource are:

Link to this section Summary

Functions

A section for declaring resource actions.

A section for declaring attributes on the resource.

A section for declaring relationships on the resource.

Resource-wide configuration

Link to this section Functions

A section for declaring resource actions.

All manipulation of data through the underlying data layer happens through actions. There are four types of action: create, read, update, and destroy. You may recognize these from the acronym CRUD. You can have multiple actions of the same type, as long as they have different names. This is the primary mechanism for customizing your resources to conform to your business logic. It is normal and expected to have multiple actions of each type in a large application.

If you have multiple actions of the same type, one of them must be designated as the primary action for that type, via: primary?: true. This tells the ash what to do if an action of that type is requested, but no specific action name is given.

Constructors

Link to this macro

attributes(body)

View Source (macro)

A section for declaring attributes on the resource.

Attributes are fields on an instance of a resource. The two required pieces of knowledge are the field name, and the type.

Constructors

Link to this macro

relationships(body)

View Source (macro)

A section for declaring relationships on the resource.

Relationships are a core component of resource oriented design. Many components of Ash will use these relationships. A simple use case is side_loading (done via the Ash.Query.side_load/2).

Constructors

Link to this macro

resource(body)

View Source (macro)

Resource-wide configuration

Options

  • :description