ash v0.1.9 Ash.Resource behaviour View Source

A resource is a static definition of an entity in your system.

Resource DSL documentation: Ash.Resource.DSL

The following options apply to use Ash.Resource, [...]

  • :name - Required. The name of the resource, e.g posts or authors. This will typically be the pluralized form of the type

  • :type - Required. The type of the resource, e.g post or author. This is used throughout the system.

For more information on the resource DSL, see Ash.Resource.DSL

Note: Do not call the functions on a resource, as in MyResource.type() as this is a private API and can change at any time. Instead, use the Ash module, for example: Ash.type(MyResource)

Link to this section Summary

Callbacks

A list of actions available for the resource

A list of attributes on the resource

A list of authorizers to be used when accessing the resource

The data_layer in use by the resource, or nil if there is not one

A description of the resource, to be showed in generated documentation

A list of extensions implemented by the resource

The name of the resource, e.g 'posts'

A list of attribute names that make up the primary key, e.g [:class, :group]

A list of relationships to other resources

The type of the resource, e.g 'post'

Link to this section Callbacks

A list of actions available for the resource

Link to this callback

attributes()

View Source
attributes() :: [Ash.attribute()]

A list of attributes on the resource

Link to this callback

authorizers()

View Source
authorizers() :: [module()]

A list of authorizers to be used when accessing the resource

Link to this callback

data_layer()

View Source
data_layer() :: module() | nil

The data_layer in use by the resource, or nil if there is not one

A description of the resource, to be showed in generated documentation

Link to this callback

extensions()

View Source
extensions() :: [module()]

A list of extensions implemented by the resource

The name of the resource, e.g 'posts'

Link to this callback

primary_key()

View Source
primary_key() :: [atom()]

A list of attribute names that make up the primary key, e.g [:class, :group]

Link to this callback

relationships()

View Source
relationships() :: [Ash.relationship()]

A list of relationships to other resources

The type of the resource, e.g 'post'