

Ash — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L1 "View Source")

===========================================================================================================

Ash Framework

![Logo](https://github.com/ash-project/ash/blob/master/logos/cropped-for-header.png?raw=true)

 Quick Links

--------------

* [Resource DSL Documentation](Ash.Dsl.html)

* [Api DSL Documentation](Ash.Api.Dsl.html)

* [Api interface documentation](Ash.Api.html)

* [Query Documentation](Ash.Query.html)

* [Changeset Documentation](Ash.Changeset.html)

* [Guides](getting_started.html)

 Introduction

---------------

Traditional MVC Frameworks (Rails, Django, .Net, Phoenix, etc) leave it up to the user to build the glue between requests for data (HTTP requests in various forms as well as server-side domain logic) and their respective ORMs. In that space, there is an incredible amount of boilerplate code that must get written from scratch for each application (authentication, authorization, sorting, filtering, sideloading relationships, serialization, etc).

Ash is an opinionated yet configurable framework designed to reduce boilerplate in an Elixir application. Ash does this by providing a layer of abstraction over your system's data layer(s) with `Resources`. It is designed to be used in conjunction with a phoenix application, or on its own.

To riff on a famous JRR Tolkien quote, a `Resource`is "One Interface to rule them all, One Interface to find them" and will become an indispensable place to define contracts for interacting with data throughout your application.

To start using Ash, first declare your `Resources` using the Ash `Resource` DSL. You could technically stop there, and just leverage the Ash Elixir API to avoid writing boilerplate. More likely, you would use extensions like Ash.JsonApi or Ash.GraphQL with Phoenix to add external interfaces to those resources without having to write any extra code at all.

Ash is an open-source project and draws inspiration from similar ideas in other frameworks and concepts. The goal of Ash is to lower the barrier to adopting and using Elixir and Phoenix, and in doing so help these amazing communities attract new developers, projects, and companies.

 Example Resource

-------------------

```

defmodule Post do

 use Ash.Resource

 actions do

 read :default

 create :default

 end

 attributes do

 attribute :name, :string

 end

 relationships do

 belongs\_to :author, Author

 end

end

```

See the [getting started guide](getting_started.html) for more information.

For those looking to add ash extensions:

* see [`Ash.Dsl.Extension`](Ash.Dsl.Extension.html) for adding configuration.

* If you are looking to write a new data source, also see the [`Ash.DataLayer`](Ash.DataLayer.html) documentation.

* If you are looking to write a new authorizer, see [`Ash.Authorizer`](Ash.Authorizer.html)

* If you are looking to write a "front end", something powered by Ash resources, a guide on

building those kinds of tools is in the works.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[action()](#t:action/0)

[action\_type()](#t:action_type/0)

[actor()](#t:actor/0)

[api()](#t:api/0)

[attribute()](#t:attribute/0)

[cardinality\_many\_relationship()](#t:cardinality_many_relationship/0)

[cardinality\_one\_relationship()](#t:cardinality_one_relationship/0)

[changeset()](#t:changeset/0)

[data\_layer()](#t:data_layer/0)

[data\_layer\_query()](#t:data_layer_query/0)

[error()](#t:error/0)

[filter()](#t:filter/0)

[params()](#t:params/0)

[primary\_key()](#t:primary_key/0)

[query()](#t:query/0)

[record()](#t:record/0)

[relationship()](#t:relationship/0)

[relationship\_cardinality()](#t:relationship_cardinality/0)

[resource()](#t:resource/0)

[side\_loads()](#t:side_loads/0)

[sort()](#t:sort/0)

[validation()](#t:validation/0)

[Functions](#functions)

------------------------

[extensions(resource)](#extensions/1)

Returns all extensions of a resource or api

[implements\_behaviour?(module, behaviour)](#implements_behaviour?/2)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:action/0 "Link to this type")

action()

========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L63 "View Source")

Specs

-----

```

action() ::

  [Ash.Resource.Actions.Create.t](Ash.Resource.Actions.Create.html#t:t/0)()

  | [Ash.Resource.Actions.Read.t](Ash.Resource.Actions.Read.html#t:t/0)()

  | [Ash.Resource.Actions.Update.t](Ash.Resource.Actions.Update.html#t:t/0)()

  | [Ash.Resource.Actions.Destroy.t](Ash.Resource.Actions.Destroy.html#t:t/0)()

```

[Link to this type](#t:action_type/0 "Link to this type")

action\_type()

==============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L64 "View Source")

Specs

-----

```

action_type() :: :read | :create | :update | :destroy

```

[Link to this type](#t:actor/0 "Link to this type")

actor()

=======

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L65 "View Source")

Specs

-----

```

actor() :: [record](#t:record/0)()

```

[Link to this type](#t:api/0 "Link to this type")

api()

=====

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L66 "View Source")

Specs

-----

```

api() :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this type](#t:attribute/0 "Link to this type")

attribute()

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L67 "View Source")

Specs

-----

```

attribute() :: Ash.Resource.Attribute.t()

```

[Link to this type](#t:cardinality_many_relationship/0 "Link to this type")

cardinality\_many\_relationship()

=================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L68 "View Source")

Specs

-----

```

cardinality_many_relationship() ::

  [Ash.Resource.Relationships.HasMany.t](Ash.Resource.Relationships.HasMany.html#t:t/0)()

  | [Ash.Resource.Relationships.ManyToMany.t](Ash.Resource.Relationships.ManyToMany.html#t:t/0)()

```

[Link to this type](#t:cardinality_one_relationship/0 "Link to this type")

cardinality\_one\_relationship()

================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L69 "View Source")

Specs

-----

```

cardinality_one_relationship() ::

  [Ash.Resource.Relationships.HasOne.t](Ash.Resource.Relationships.HasOne.html#t:t/0)()

  | [Ash.Resource.Relationships.BelongsTo.t](Ash.Resource.Relationships.BelongsTo.html#t:t/0)()

```

[Link to this type](#t:changeset/0 "Link to this type")

changeset()

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L70 "View Source")

Specs

-----

```

changeset() :: [Ash.Changeset.t](Ash.Changeset.html#t:t/0)()

```

[Link to this type](#t:data_layer/0 "Link to this type")

data\_layer()

=============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L71 "View Source")

Specs

-----

```

data_layer() :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this type](#t:data_layer_query/0 "Link to this type")

data\_layer\_query()

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L72 "View Source")

Specs

-----

```

data_layer_query() :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

[Link to this type](#t:error/0 "Link to this type")

error()

=======

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L73 "View Source")

Specs

-----

```

error() :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

[Link to this type](#t:filter/0 "Link to this type")

filter()

========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L74 "View Source")

Specs

-----

```

filter() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

[Link to this type](#t:params/0 "Link to this type")

params()

========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L75 "View Source")

Specs

-----

```

params() :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()

```

[Link to this type](#t:primary_key/0 "Link to this type")

primary\_key()

==============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L76 "View Source")

Specs

-----

```

primary_key() :: [record](#t:record/0)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this type](#t:query/0 "Link to this type")

query()

=======

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L77 "View Source")

Specs

-----

```

query() :: [Ash.Query.t](Ash.Query.html#t:t/0)()

```

[Link to this type](#t:record/0 "Link to this type")

record()

========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L78 "View Source")

Specs

-----

```

record() :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

[Link to this type](#t:relationship/0 "Link to this type")

relationship()

==============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L79 "View Source")

Specs

-----

```

relationship() ::

  [cardinality\_one\_relationship](#t:cardinality_one_relationship/0)() | [cardinality\_many\_relationship](#t:cardinality_many_relationship/0)()

```

[Link to this type](#t:relationship_cardinality/0 "Link to this type")

relationship\_cardinality()

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L80 "View Source")

Specs

-----

```

relationship_cardinality() :: :many | :one

```

[Link to this type](#t:resource/0 "Link to this type")

resource()

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L81 "View Source")

Specs

-----

```

resource() :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this type](#t:side_loads/0 "Link to this type")

side\_loads()

=============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L82 "View Source")

Specs

-----

```

side_loads() :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()

```

[Link to this type](#t:sort/0 "Link to this type")

sort()

======

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L83 "View Source")

Specs

-----

```

sort() :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()

```

[Link to this type](#t:validation/0 "Link to this type")

validation()

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L84 "View Source")

Specs

-----

```

validation() :: [Ash.Resource.Validation.t](Ash.Resource.Validation.html#t:t/0)()

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#extensions/1 "Link to this function")

extensions(resource)

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L100 "View Source")

Specs

-----

```

extensions([resource](#t:resource/0)() | [api](#t:api/0)()) :: [[module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()]

```

Returns all extensions of a resource or api

 

[Link to this function](#implements_behaviour?/2 "Link to this function")

implements\_behaviour?(module, behaviour)

=========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L88 "View Source")





Ash.Api — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Api behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L1 "View Source")

=================================================================================================================================

An Api allows you to interact with your resources, and holds non-resource-specific configuration.

Your Api can also house config that is not resource specific.

Defining a resource won't do much for you. Once you have some resources defined,

you include them in an Api like so:

```

defmodule MyApp.Api do

 use Ash.Api

 resources do

 resource OneResource

 resource SecondResource

end

```

Then you can interact through that Api with the actions that those resources expose.

For example: `MyApp.Api.create(changeset)`, or `MyApp.Api.read(query)`. Corresponding

actions must be defined in your resources in order to call them through the Api.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[resource(api, resource)](#resource/2)

[resources(api)](#resources/1)

[Callbacks](#callbacks)

------------------------

[create(resource, params)](#c:create/2)

Create a record.

[create!(resource, params)](#c:create!/2)

Create a record. See [`create/2`](#c:create/2) for more information.

[destroy(record, params)](#c:destroy/2)

Destroy a record.

[destroy!(record, params)](#c:destroy!/2)

Destroy a record. See [`destroy/2`](#c:destroy/2) for more information.

[get(resource, id\_or\_filter, params)](#c:get/3)

Get a record by a primary key.

[get!(resource, id\_or\_filter, params)](#c:get!/3)

Get a record by a primary key. See [`get/3`](#c:get/3) for more.

[read(arg1, params)](#c:read/2)

Run a query on a resource.

[read!(arg1, params)](#c:read!/2)

Run an ash query. See [`read/2`](#c:read/2) for more.

[reload(record)](#c:reload/1)

Refetches a record by primary key.

[reload!(record, params)](#c:reload!/2)

Refetches a record by primary key. See [`reload/1`](#c:reload/1) for more.

[side\_load(resource, params)](#c:side_load/2)

Side load on already fetched records.

[side\_load!(resource, params)](#c:side_load!/2)

Side load on already fetched records. See [`side_load/2`](#c:side_load/2) for more information.

[update(record, params)](#c:update/2)

Update a record.

[update!(record, params)](#c:update!/2)

Update a record. See [`update/2`](#c:update/2) for more information.

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#resource/2 "Link to this function")

resource(api, resource)

=======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L247 "View Source")

[Link to this function](#resources/1 "Link to this function")

resources(api)

==============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L258 "View Source")

Specs

-----

```

resources([Ash.api](Ash.html#t:api/0)()) :: [[Ash.resource](Ash.html#t:resource/0)()]

```

[Link to this section](#callbacks)

Callbacks

=============================================

[Link to this callback](#c:create/2 "Link to this callback")

create(resource, params)

========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L169 "View Source")

Specs

-----

```

create(resource :: [Ash.resource](Ash.html#t:resource/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()}

```

Create a record.

* `:upsert?` - If a conflict is found based on the primary key, the record is updated in the database (requires upsert support) The default value is `false`.

* `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2)

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:create!/2 "Link to this callback")

create!(resource, params)

=========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L161 "View Source")

Specs

-----

```

create!(resource :: [Ash.resource](Ash.html#t:resource/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  [Ash.record](Ash.html#t:record/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Create a record. See [`create/2`](#c:create/2) for more information.

* `:upsert?` - If a conflict is found based on the primary key, the record is updated in the database (requires upsert support) The default value is `false`.

* `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2)

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:destroy/2 "Link to this callback")

destroy(record, params)

=======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L200 "View Source")

Specs

-----

```

destroy(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  :ok | {:error, [Ash.error](Ash.html#t:error/0)()}

```

Destroy a record.

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:destroy!/2 "Link to this callback")

destroy!(record, params)

========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L193 "View Source")

Specs

-----

```

destroy!(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: :ok | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Destroy a record. See [`destroy/2`](#c:destroy/2) for more information.

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:get/3 "Link to this callback")

get(resource, id\_or\_filter, params)

=====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L116 "View Source")

Specs

-----

```

get(resource :: [Ash.resource](Ash.html#t:resource/0)(), id_or_filter :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()}

```

Get a record by a primary key.

For a resource with a composite primary key, pass a keyword list, e.g

`MyApi.get(MyResource, first_key: 1, second_key: 2)`

* `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2)

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:get!/3 "Link to this callback")

get!(resource, id\_or\_filter, params)

======================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L105 "View Source")

Specs

-----

```

get!(resource :: [Ash.resource](Ash.html#t:resource/0)(), id_or_filter :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  [Ash.record](Ash.html#t:record/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Get a record by a primary key. See [`get/3`](#c:get/3) for more.

* `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2)

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:read/2 "Link to this callback")

read(arg1, params)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L134 "View Source")

Specs

-----

```

read([Ash.query](Ash.html#t:query/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  {:ok, [[Ash.resource](Ash.html#t:resource/0)()]} | {:error, [Ash.error](Ash.html#t:error/0)()}

```

Run a query on a resource.

For more information, on building a query, see [`Ash.Query`](Ash.Query.html).

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:read!/2 "Link to this callback")

read!(arg1, params)

===================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L124 "View Source")

Specs

-----

```

read!([Ash.query](Ash.html#t:query/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [[Ash.resource](Ash.html#t:resource/0)()] | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Run an ash query. See [`read/2`](#c:read/2) for more.

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:reload/1 "Link to this callback")

reload(record)

==============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L211 "View Source")

Specs

-----

```

reload(record :: [Ash.record](Ash.html#t:record/0)()) :: {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()}

```

Refetches a record by primary key.

 

[Link to this callback](#c:reload!/2 "Link to this callback")

reload!(record, params)

=======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L206 "View Source")

Specs

-----

```

reload!(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  [Ash.record](Ash.html#t:record/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Refetches a record by primary key. See [`reload/1`](#c:reload/1) for more.

 

[Link to this callback](#c:side_load/2 "Link to this callback")

side\_load(resource, params)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L153 "View Source")

Specs

-----

```

side_load(resource :: [Ash.resource](Ash.html#t:resource/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)() | [Ash.query](Ash.html#t:query/0)()) ::

  {:ok, [[Ash.resource](Ash.html#t:resource/0)()]} | {:error, [Ash.error](Ash.html#t:error/0)()}

```

Side load on already fetched records.

Accepts a keyword list of side loads as they would be passed into [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2)

or an `%Ash.Query{}`, in which case that query's side loads are used.

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:side_load!/2 "Link to this callback")

side\_load!(resource, params)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L142 "View Source")

Specs

-----

```

side_load!(resource :: [Ash.resource](Ash.html#t:resource/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)() | [Ash.query](Ash.html#t:query/0)()) ::

  [[Ash.resource](Ash.html#t:resource/0)()] | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Side load on already fetched records. See [`side_load/2`](#c:side_load/2) for more information.

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:update/2 "Link to this callback")

update(record, params)

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L185 "View Source")

Specs

-----

```

update(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()}

```

Update a record.

* `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2)

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 

[Link to this callback](#c:update!/2 "Link to this callback")

update!(record, params)

=======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L177 "View Source")

Specs

-----

```

update!(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) ::

  [Ash.record](Ash.html#t:record/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Update a record. See [`update/2`](#c:update/2) for more information.

* `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2)

* `:verbose?` - Log engine operations (very verbose?) The default value is `false`.

* `:action` - The action to use, either an Action struct or the name of the action

* `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`.

* `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access

 





Ash.Api.Dsl — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Api.Dsl [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/dsl.ex#L1 "View Source")

===========================================================================================================================

A small DSL for declaring APIs

Apis are the entrypoints for working with your resources.

* resources - [`resources/1`](#resources/1)

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[resources(body)](#resources/1)

List the resources present in this API

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#resources/1 "Link to this macro")

resources(body)

===============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/dsl.ex#L41 "View Source")

(macro)

List the resources present in this API

 Constructors

---------------

* resource - [`Ash.Api.Dsl.Resource`](Ash.Api.Dsl.Resource.html)

 





Ash.Api.Dsl.Resource — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Api.Dsl.Resource [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

============================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[resource(resource, opts \\ [])](#resource/2)

A reference to a resource

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#resource/2 "Link to this macro")

resource(resource, opts \\ [])

==============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

A reference to a resource

 Examples

-----------

```

resource MyApp.User

```

 Arguments

------------

* `:resource` - The module of the resource

 





Ash.Api.ResourceReference — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Api.ResourceReference [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/resource_reference.ex#L1 "View Source")

========================================================================================================================================================

Represents a resource in an API

 





Ash.Api.Transformers.EnsureResourcesCompiled — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Api.Transformers.EnsureResourcesCompiled [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L1 "View Source")

===============================================================================================================================================================================================

Ensures that all resources for a given api are compiled.

This is required for later transformers.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(\_)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(module, dsl)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(\_)

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L7 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L7 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L7 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(module, dsl)

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L11 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Api.Transformers.ValidateManyToManyJoinAttributes — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Api.Transformers.ValidateManyToManyJoinAttributes [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L1 "View Source")

====================================================================================================================================================================================================================

Validates that `join_attributes` on many to many relationships exist on the join resource

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(arg1)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(api, dsl)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(arg1)

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L41 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(api, dsl)

===================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L9 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Api.Transformers.ValidateRelatedResourceInclusion — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Api.Transformers.ValidateRelatedResourceInclusion [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_related_resource_inclusion.ex#L1 "View Source")

==================================================================================================================================================================================================================

Ensures that all related resources are included in an API.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_related_resource_inclusion.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_related_resource_inclusion.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 





Ash.Api.Transformers.ValidateRelationshipAttributes — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Api.Transformers.ValidateRelationshipAttributes [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L1 "View Source")

=============================================================================================================================================================================================================

Validates that all relationships point to valid fields

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(arg1)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(api, dsl)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(arg1)

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L75 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(api, dsl)

===================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L9 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Authorizer — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Authorizer behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L1 "View Source")

===========================================================================================================================================

The interface for an ash authorizer

These will typically be implemented by an extension, but a custom

one can be implemented by defining a module that adopts this behaviour

and using `@authorizers YourAuthorizer` to your resource.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[context()](#t:context/0)

[state()](#t:state/0)

[Functions](#functions)

------------------------

[check(module, state, context)](#check/3)

[check\_context(module, state)](#check_context/2)

[initial\_state(module, actor, resource, action, verbose?)](#initial_state/5)

[strict\_check(module, state, context)](#strict_check/3)

[strict\_check\_context(module, state)](#strict_check_context/2)

[Callbacks](#callbacks)

------------------------

[check(state, context)](#c:check/2)

[check\_context(state)](#c:check_context/1)

[initial\_state(arg1, arg2, arg3, boolean)](#c:initial_state/4)

[strict\_check(state, context)](#c:strict_check/2)

[strict\_check\_context(state)](#c:strict_check_context/1)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:context/0 "Link to this type")

context()

=========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L10 "View Source")

Specs

-----

```

context() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

[Link to this type](#t:state/0 "Link to this type")

state()

=======

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L9 "View Source")

Specs

-----

```

state() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#check/3 "Link to this function")

check(module, state, context)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L39 "View Source")

[Link to this function](#check_context/2 "Link to this function")

check\_context(module, state)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L35 "View Source")

[Link to this function](#initial_state/5 "Link to this function")

initial\_state(module, actor, resource, action, verbose?)

=========================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L23 "View Source")

[Link to this function](#strict_check/3 "Link to this function")

strict\_check(module, state, context)

=====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L31 "View Source")

[Link to this function](#strict_check_context/2 "Link to this function")

strict\_check\_context(module, state)

=====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L27 "View Source")

[Link to this section](#callbacks)

Callbacks

=============================================

[Link to this callback](#c:check/2 "Link to this callback")

check(state, context)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L20 "View Source")

Specs

-----

```

check([state](#t:state/0)(), [context](#t:context/0)()) ::

  :authorized | {:data, [[Ash.record](Ash.html#t:record/0)()]} | {:error, [Ash.error](Ash.html#t:error/0)()}

```

[Link to this callback](#c:check_context/1 "Link to this callback")

check\_context(state)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L19 "View Source")

Specs

-----

```

check_context([state](#t:state/0)()) :: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]

```

[Link to this callback](#c:initial_state/4 "Link to this callback")

initial\_state(arg1, arg2, arg3, boolean)

=========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L11 "View Source")

Specs

-----

```

initial_state([Ash.resource](Ash.html#t:resource/0)(), [Ash.actor](Ash.html#t:actor/0)(), [Ash.action](Ash.html#t:action/0)(), [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [state](#t:state/0)()

```

[Link to this callback](#c:strict_check/2 "Link to this callback")

strict\_check(state, context)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L13 "View Source")

Specs

-----

```

strict_check([state](#t:state/0)(), [context](#t:context/0)()) ::

  :authorized

  | {:continue, [state](#t:state/0)()}

  | {:filter, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()}

  | {:filter_and_continue, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)(), [state](#t:state/0)()}

  | {:error, [Ash.error](Ash.html#t:error/0)()}

```

[Link to this callback](#c:strict_check_context/1 "Link to this callback")

strict\_check\_context(state)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L12 "View Source")

Specs

-----

```

strict_check_context([state](#t:state/0)()) :: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]

```





Ash.Changeset — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Changeset [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L1 "View Source")

=========================================================================================================================================

Changesets are used to create and update data in Ash.

Create a changeset with `create/2` or `update/2`, and alter the attributes

and relationships using the functions provided in this module. Nothing in this module

actually incurs changes in a data layer. To commit a changeset, see [`Ash.Api.create/2`](Ash.Api.html#c:create/2)

and [`Ash.Api.update/2`](Ash.Api.html#c:update/2).

 Primary Keys

---------------

For relationship manipulation using [`append_to_relationship/3`](#append_to_relationship/3), [`remove_from_relationship/3`](#remove_from_relationship/3)

and [`replace_relationship/3`](#replace_relationship/3) there are three types that can be used for primary keys:

1.) An instance of the resource in question.

2.) If the primary key is just a single field, i.e `:id`, then a single value, i.e `1`

3.) A map of keys to values representing the primary key, i.e `%{id: 1}` or `%{id: 1, org_id: 2}`

 Join Attributes

------------------

For many to many relationships, the attributes on a join relationship may be set while relating items

by passing a tuple of the primary key and the changes to be applied. This is done via upserts, so

update validations on the join resource are *not* applied, but create validations are.

For example:

```

Ash.Changeset.replace\_relationship(changeset, :linked\_tickets, [

 {1, %{link\_type: "blocking"}},

 {a\_ticket, %{link\_type: "caused\_by"}},

 {%{id: 2}, %{link\_type: "related\_to"}}

])

```

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Functions](#functions)

------------------------

[add\_error(changeset, error)](#add_error/2)

Adds an error to the changesets errors list, and marks the change as `valid?: false`

[after\_action(changeset, func)](#after_action/2)

Adds an after\_action hook to the changeset.

[append\_to\_relationship(changeset, relationship, record\_or\_records)](#append_to_relationship/3)

Appends a record of list of records to a relationship. Stacks with previous removals/additions.

[apply\_attributes(changeset)](#apply_attributes/1)

Returns the original data with attribute changes merged.

[before\_action(changeset, func)](#before_action/2)

Adds a before\_action hook to the changeset.

[change\_attribute(changeset, attribute, value)](#change_attribute/3)

Adds a change to the changeset, unless the value matches the existing value

[change\_attributes(changeset, changes)](#change_attributes/2)

Calls [`change_attribute/3`](#change_attribute/3) for each key/value pair provided

[change\_new\_attribute(changeset, attribute, value)](#change_new_attribute/3)

Change an attribute only if is not currently being changed

[change\_new\_attribute\_lazy(changeset, attribute, func)](#change_new_attribute_lazy/3)

Change an attribute if is not currently being changed, by calling the provided function

[changing\_attribute?(changeset, attribute)](#changing_attribute?/2)

Returns true if an attribute exists in the changes

[fetch\_change(changeset, attribute)](#fetch_change/2)

Gets the new value for an attribute, or `:error` if it is not being changed

[force\_change\_attribute(changeset, attribute, value)](#force_change_attribute/3)

Changes an attribute even if it isn't writable

[force\_change\_attributes(changeset, changes)](#force_change_attributes/2)

Calls [`force_change_attribute/3`](#force_change_attribute/3) for each key/value pair provided

[get\_attribute(changeset, attribute)](#get_attribute/2)

Gets the changing value or the original value of an attribute

[get\_data(changeset, attribute)](#get_data/2)

Gets the original value for an attribute

[new(resource, initial\_attributes \\ %{})](#new/2)

Return a changeset over a resource or a record

[remove\_from\_relationship(changeset, relationship, record\_or\_records)](#remove_from_relationship/3)

Removes a record of list of records to a relationship. Stacks with previous removals/additions.

[replace\_relationship(changeset, relationship, record\_or\_records)](#replace_relationship/3)

Replaces the value of a relationship. Any previous additions/removals are cleared.

[with\_hooks(changeset, func)](#with_hooks/2)

Wraps a function in the before/after action hooks of a changeset.

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L74 "View Source")

Specs

-----

```

t() :: %Ash.Changeset{

  action_type: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  after_action: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  api: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  attributes: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  before_action: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  change_dependencies: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  data: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  errors: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  relationships: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  requests: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  resource: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  valid?: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#add_error/2 "Link to this function")

add\_error(changeset, error)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L548 "View Source")

Specs

-----

```

add_error([t](#t:t/0)(), [Ash.error](Ash.html#t:error/0)()) :: [t](#t:t/0)()

```

Adds an error to the changesets errors list, and marks the change as `valid?: false`

 

[Link to this function](#after_action/2 "Link to this function")

after\_action(changeset, func)

==============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L534 "View Source")

Specs

-----

```

after_action([t](#t:t/0)(), ([t](#t:t/0)(), [Ash.record](Ash.html#t:record/0)() -> {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()})) ::

  [t](#t:t/0)()

```

Adds an after\_action hook to the changeset.

 

[Link to this function](#append_to_relationship/3 "Link to this function")

append\_to\_relationship(changeset, relationship, record\_or\_records)

======================================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L185 "View Source")

Specs

-----

```

append_to_relationship([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.primary\_key](Ash.html#t:primary_key/0)() | [[Ash.primary\_key](Ash.html#t:primary_key/0)()]) ::

  [t](#t:t/0)()

```

Appends a record of list of records to a relationship. Stacks with previous removals/additions.

Accepts a primary key or a list of primary keys. See the section on "Primary Keys" in the

module documentation for more.

For many to many relationships, accepts changes for any `join_attributes` configured on

the resource. See the section on "Join Attributes" in the module documentation for more.

Cannot be used with `belongs_to` or `has_one` relationships.

See [`replace_relationship/3`](#replace_relationship/3) for manipulating `belongs_to` and `has_one` relationships.

 

[Link to this function](#apply_attributes/1 "Link to this function")

apply\_attributes(changeset)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L540 "View Source")

Specs

-----

```

apply_attributes([t](#t:t/0)()) :: [Ash.record](Ash.html#t:record/0)()

```

Returns the original data with attribute changes merged.

 

[Link to this function](#before_action/2 "Link to this function")

before\_action(changeset, func)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L528 "View Source")

Specs

-----

```

before_action([t](#t:t/0)(), ([t](#t:t/0)() -> [t](#t:t/0)())) :: [t](#t:t/0)()

```

Adds a before\_action hook to the changeset.

 

[Link to this function](#change_attribute/3 "Link to this function")

change\_attribute(changeset, attribute, value)

==============================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L436 "View Source")

Adds a change to the changeset, unless the value matches the existing value

 

[Link to this function](#change_attributes/2 "Link to this function")

change\_attributes(changeset, changes)

======================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L429 "View Source")

Specs

-----

```

change_attributes([t](#t:t/0)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [t](#t:t/0)()

```

Calls [`change_attribute/3`](#change_attribute/3) for each key/value pair provided

 

[Link to this function](#change_new_attribute/3 "Link to this function")

change\_new\_attribute(changeset, attribute, value)

===================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L404 "View Source")

Specs

-----

```

change_new_attribute([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)()

```

Change an attribute only if is not currently being changed

 

[Link to this function](#change_new_attribute_lazy/3 "Link to this function")

change\_new\_attribute\_lazy(changeset, attribute, func)

========================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L419 "View Source")

Specs

-----

```

change_new_attribute_lazy([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), (() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)())) :: [t](#t:t/0)()

```

Change an attribute if is not currently being changed, by calling the provided function

Use this if you want to only perform some expensive calculation for an attribute value

only if there isn't already a change for that attribute

 

[Link to this function](#changing_attribute?/2 "Link to this function")

changing\_attribute?(changeset, attribute)

==========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L398 "View Source")

Specs

-----

```

changing_attribute?([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Returns true if an attribute exists in the changes

 

[Link to this function](#fetch_change/2 "Link to this function")

fetch\_change(changeset, attribute)

===================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L162 "View Source")

Specs

-----

```

fetch_change([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: {:ok, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | :error

```

Gets the new value for an attribute, or `:error` if it is not being changed

 

[Link to this function](#force_change_attribute/3 "Link to this function")

force\_change\_attribute(changeset, attribute, value)

=====================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L488 "View Source")

Specs

-----

```

force_change_attribute([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)()

```

Changes an attribute even if it isn't writable

 

[Link to this function](#force_change_attributes/2 "Link to this function")

force\_change\_attributes(changeset, changes)

=============================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L480 "View Source")

Specs

-----

```

force_change_attributes([t](#t:t/0)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)()

```

Calls [`force_change_attribute/3`](#force_change_attribute/3) for each key/value pair provided

 

[Link to this function](#get_attribute/2 "Link to this function")

get\_attribute(changeset, attribute)

====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L150 "View Source")

Specs

-----

```

get_attribute([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Gets the changing value or the original value of an attribute

 

[Link to this function](#get_data/2 "Link to this function")

get\_data(changeset, attribute)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L168 "View Source")

Specs

-----

```

get_data([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: {:ok, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | :error

```

Gets the original value for an attribute

 

[Link to this function](#new/2 "Link to this function")

new(resource, initial\_attributes \\ %{})

=========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L86 "View Source")

Specs

-----

```

new([Ash.resource](Ash.html#t:resource/0)() | [Ash.record](Ash.html#t:record/0)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)()

```

Return a changeset over a resource or a record

 

[Link to this function](#remove_from_relationship/3 "Link to this function")

remove\_from\_relationship(changeset, relationship, record\_or\_records)

========================================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L254 "View Source")

Specs

-----

```

remove_from_relationship([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.primary\_key](Ash.html#t:primary_key/0)() | [[Ash.primary\_key](Ash.html#t:primary_key/0)()]) ::

  [t](#t:t/0)()

```

Removes a record of list of records to a relationship. Stacks with previous removals/additions.

Accepts a primary key or a list of primary keys. See the section on "Primary Keys" in the

module documentation for more.

Cannot be used with `belongs_to` or `has_one` relationships.

See [`replace_relationship/3`](#replace_relationship/3) for manipulating those relationships.

 

[Link to this function](#replace_relationship/3 "Link to this function")

replace\_relationship(changeset, relationship, record\_or\_records)

===================================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L329 "View Source")

Specs

-----

```

replace_relationship([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.primary\_key](Ash.html#t:primary_key/0)() | [[Ash.primary\_key](Ash.html#t:primary_key/0)()]) ::

  [t](#t:t/0)()

```

Replaces the value of a relationship. Any previous additions/removals are cleared.

Accepts a primary key or a list of primary keys. See the section on "Primary Keys" in the

module documentation for more.

For many to many relationships, accepts changes for any `join_attributes` configured on

the resource. See the section on "Join Attributes" in the module documentation for more.

For a `has_many` or `many_to_many` relationship, this means removing any currently related

records that are not present in the replacement list, and creating any that do not exist

in the data layer.

For a `belongs_to` or `has_one`, replace with a `nil` value to unset a relationship.

 

[Link to this function](#with_hooks/2 "Link to this function")

with\_hooks(changeset, func)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L117 "View Source")

Specs

-----

```

with_hooks([t](#t:t/0)(), ([t](#t:t/0)() -> {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()})) ::

  {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

Wraps a function in the before/after action hooks of a changeset.

The function takes a changeset and if it returns

`{:ok, result}`, the result will be passed through the after

action hooks.

 





Ash.DataLayer — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.DataLayer behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L1 "View Source")

=====================================================================================================================================================

The interface for being an ash data layer.

This is a large behaviour, and this capability is not complete, but the idea

is to have a large amount of optional callbacks, and use the [`can?/2`](#can?/2) callback

to ensure that the engine only ever tries to interact with the data layer in ways

that it supports.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[feature()](#t:feature/0)

[Functions](#functions)

------------------------

[can?(feature, resource)](#can?/2)

[create(resource, changeset)](#create/2)

[custom\_filters(resource)](#custom_filters/1)

[filter(query, filter, resource)](#filter/3)

[limit(query, limit, resource)](#limit/3)

[offset(query, offset, resource)](#offset/3)

[resource\_to\_query(resource)](#resource_to_query/1)

[run\_query(query, central\_resource)](#run_query/2)

[sort(query, sort, resource)](#sort/3)

[source(resource)](#source/1)

[transact(resource, func)](#transact/2)

[update(resource, changeset)](#update/2)

[upsert(resource, changeset)](#upsert/2)

[Callbacks](#callbacks)

------------------------

[can?(arg1, feature)](#c:can?/2)

[create(arg1, arg2)](#c:create/2)

[custom\_filters(arg1)](#c:custom_filters/1)

[destroy(record)](#c:destroy/1)

[filter(arg1, arg2, resource)](#c:filter/3)

[in\_transaction?(arg1)](#c:in_transaction?/1)

[limit(arg1, limit, resource)](#c:limit/3)

[offset(arg1, offset, resource)](#c:offset/3)

[resource\_to\_query(arg1)](#c:resource_to_query/1)

[rollback(arg1, term)](#c:rollback/2)

[run\_query(arg1, arg2)](#c:run_query/2)

[sort(arg1, arg2, resource)](#c:sort/3)

[source(arg1)](#c:source/1)

[transaction(arg1, function)](#c:transaction/2)

[update(arg1, arg2)](#c:update/2)

[upsert(arg1, arg2)](#c:upsert/2)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:feature/0 "Link to this type")

feature()

=========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L10 "View Source")

Specs

-----

```

feature() ::

  :transact

  | :boolean_filter

  | :async_engine

  | :join

  | :transact

  | {:filter_predicate, [Ash.Type.t](Ash.Type.html#t:t/0)(), [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)()}

  | {:sort, [Ash.Type.t](Ash.Type.html#t:t/0)()}

  | :upsert

  | :delete_with_query

  | :composite_primary_key

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#can?/2 "Link to this function")

can?(feature, resource)

=======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L124 "View Source")

Specs

-----

```

can?([feature](#t:feature/0)(), [Ash.resource](Ash.html#t:resource/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this function](#create/2 "Link to this function")

create(resource, changeset)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L70 "View Source")

Specs

-----

```

create([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) ::

  {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this function](#custom_filters/1 "Link to this function")

custom\_filters(resource)

=========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L144 "View Source")

[Link to this function](#filter/3 "Link to this function")

filter(query, filter, resource)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L91 "View Source")

Specs

-----

```

filter([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.filter](Ash.html#t:filter/0)(), [Ash.resource](Ash.html#t:resource/0)()) ::

  {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this function](#limit/3 "Link to this function")

limit(query, limit, resource)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L107 "View Source")

Specs

-----

```

limit([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), limit :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.resource](Ash.html#t:resource/0)()) ::

  {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this function](#offset/3 "Link to this function")

offset(query, offset, resource)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L116 "View Source")

Specs

-----

```

offset([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), offset :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.resource](Ash.html#t:resource/0)()) ::

  {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this function](#resource_to_query/1 "Link to this function")

resource\_to\_query(resource)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L58 "View Source")

Specs

-----

```

resource_to_query([Ash.resource](Ash.html#t:resource/0)()) :: [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()

```

[Link to this function](#run_query/2 "Link to this function")

run\_query(query, central\_resource)

====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L131 "View Source")

Specs

-----

```

run_query([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), central_resource :: [Ash.resource](Ash.html#t:resource/0)()) ::

  {:ok, [[Ash.record](Ash.html#t:record/0)()]} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this function](#sort/3 "Link to this function")

sort(query, sort, resource)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L100 "View Source")

Specs

-----

```

sort([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.sort](Ash.html#t:sort/0)(), [Ash.resource](Ash.html#t:resource/0)()) ::

  {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this function](#source/1 "Link to this function")

source(resource)

================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L75 "View Source")

Specs

-----

```

source([Ash.resource](Ash.html#t:resource/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()

```

[Link to this function](#transact/2 "Link to this function")

transact(resource, func)

========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L135 "View Source")

[Link to this function](#update/2 "Link to this function")

update(resource, changeset)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L64 "View Source")

Specs

-----

```

update([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) ::

  {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this function](#upsert/2 "Link to this function")

upsert(resource, changeset)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L85 "View Source")

Specs

-----

```

upsert([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) ::

  {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this section](#callbacks)

Callbacks

=============================================

[Link to this callback](#c:can?/2 "Link to this callback")

can?(arg1, feature)

===================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L48 "View Source")

Specs

-----

```

can?([Ash.resource](Ash.html#t:resource/0)(), [feature](#t:feature/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this callback](#c:create/2 "Link to this callback")

create(arg1, arg2)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L37 "View Source")

Specs

-----

```

create([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) ::

  {:ok, [Ash.resource](Ash.html#t:resource/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:custom_filters/1 "Link to this callback")

custom\_filters(arg1)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L22 "View Source")

(optional)

Specs

-----

```

custom_filters([Ash.resource](Ash.html#t:resource/0)()) :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

[Link to this callback](#c:destroy/1 "Link to this callback")

destroy(record)

===============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L43 "View Source")

Specs

-----

```

destroy(record :: [Ash.record](Ash.html#t:record/0)()) :: :ok | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:filter/3 "Link to this callback")

filter(arg1, arg2, resource)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L23 "View Source")

Specs

-----

```

filter([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.filter](Ash.html#t:filter/0)(), resource :: [Ash.resource](Ash.html#t:resource/0)()) ::

  {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:in_transaction?/1 "Link to this callback")

in\_transaction?(arg1)

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L45 "View Source")

(optional)

Specs

-----

```

in_transaction?([Ash.resource](Ash.html#t:resource/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this callback](#c:limit/3 "Link to this callback")

limit(arg1, limit, resource)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L27 "View Source")

Specs

-----

```

limit(

  [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(),

  limit :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  resource :: [Ash.resource](Ash.html#t:resource/0)()

) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:offset/3 "Link to this callback")

offset(arg1, offset, resource)

==============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L29 "View Source")

Specs

-----

```

offset(

  [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(),

  offset :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  resource :: [Ash.resource](Ash.html#t:resource/0)()

) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:resource_to_query/1 "Link to this callback")

resource\_to\_query(arg1)

=========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L34 "View Source")

Specs

-----

```

resource_to_query([Ash.resource](Ash.html#t:resource/0)()) :: [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()

```

[Link to this callback](#c:rollback/2 "Link to this callback")

rollback(arg1, term)

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L47 "View Source")

(optional)

Specs

-----

```

rollback([Ash.resource](Ash.html#t:resource/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this callback](#c:run_query/2 "Link to this callback")

run\_query(arg1, arg2)

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L35 "View Source")

Specs

-----

```

run_query([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.resource](Ash.html#t:resource/0)()) ::

  {:ok, [[Ash.resource](Ash.html#t:resource/0)()]} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:sort/3 "Link to this callback")

sort(arg1, arg2, resource)

==========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L25 "View Source")

Specs

-----

```

sort([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.sort](Ash.html#t:sort/0)(), resource :: [Ash.resource](Ash.html#t:resource/0)()) ::

  {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:source/1 "Link to this callback")

source(arg1)

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L46 "View Source")

(optional)

Specs

-----

```

source([Ash.resource](Ash.html#t:resource/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()

```

[Link to this callback](#c:transaction/2 "Link to this callback")

transaction(arg1, function)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L44 "View Source")

(optional)

Specs

-----

```

transaction([Ash.resource](Ash.html#t:resource/0)(), (() -> [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)())) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:update/2 "Link to this callback")

update(arg1, arg2)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L41 "View Source")

Specs

-----

```

update([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) ::

  {:ok, [Ash.resource](Ash.html#t:resource/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this callback](#c:upsert/2 "Link to this callback")

upsert(arg1, arg2)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L39 "View Source")

(optional)

Specs

-----

```

upsert([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) ::

  {:ok, [Ash.resource](Ash.html#t:resource/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```





Ash.DataLayer.Ets — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.DataLayer.Ets [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/ets.ex#L1 "View Source")

========================================================================================================================================

An ETS (Erlang Term Storage) backed Ash Datalayer, for testing.

This is used for testing. *Do not use this data layer in production*

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[ets(body)](#ets/1)

A section for configuring the ets data layer

[filter\_matches(records, filter)](#filter_matches/2)

[private?(resource)](#private?/1)

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#ets/1 "Link to this macro")

ets(body)

=========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/ets.ex#L27 "View Source")

(macro)

A section for configuring the ets data layer

 Options

----------

* `:private?` - The default value is `false`.

 

[Link to this function](#filter_matches/2 "Link to this function")

filter\_matches(records, filter)

================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/ets.ex#L112 "View Source")

[Link to this function](#private?/1 "Link to this function")

private?(resource)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/ets.ex#L31 "View Source")

Specs

-----

```

private?([Ash.resource](Ash.html#t:resource/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```





Ash.DataLayer.Mnesia — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.DataLayer.Mnesia [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/mnesia.ex#L1 "View Source")

==============================================================================================================================================

An Mnesia backed Ash Datalayer.

In your application intialization, you will need to call `Mnesia.create_schema([node()])`.

Additionally, you will want to create your mnesia tables there.

This data layer is *extremely unoptimized*, fetching all records from a table and filtering them

in place. This is primarily used for testing the behavior of data layers in Ash. If it was improved,

it could be a viable data layer.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[mnesia(body)](#mnesia/1)

A section for configuring the mnesia data layer

[start(api)](#start/1)

[table(resource)](#table/1)

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#mnesia/1 "Link to this macro")

mnesia(body)

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/mnesia.ex#L60 "View Source")

(macro)

A section for configuring the mnesia data layer

 Options

----------

* `:table` - The table name to use, defaults to the name of the resource

 

[Link to this function](#start/1 "Link to this function")

start(api)

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/mnesia.ex#L18 "View Source")

[Link to this function](#table/1 "Link to this function")

table(resource)

===============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/mnesia.ex#L64 "View Source")





Ash.Dsl — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L1 "View Source")

=======================================================================================================================

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

* attributes - [`attributes/1`](#attributes/1)

* relationships - [`relationships/1`](#relationships/1)

* actions - [`actions/1`](#actions/1)

* validations - [`validations/1`](#validations/1)

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[actions(body)](#actions/1)

A section for declaring resource actions.

[attributes(body)](#attributes/1)

A section for declaring attributes on the resource.

[relationships(body)](#relationships/1)

A section for declaring relationships on the resource.

[resource(body)](#resource/1)

Resource-wide configuration

[validations(body)](#validations/1)

Declare validations prior to performing actions against the resource

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#actions/1 "Link to this macro")

actions(body)

=============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "View Source")

(macro)

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

---------------

* create - [`Ash.Dsl.Create`](Ash.Dsl.Create.html)

* read - [`Ash.Dsl.Read`](Ash.Dsl.Read.html)

* update - [`Ash.Dsl.Update`](Ash.Dsl.Update.html)

* destroy - [`Ash.Dsl.Destroy`](Ash.Dsl.Destroy.html)

 

[Link to this macro](#attributes/1 "Link to this macro")

attributes(body)

================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "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

---------------

* attribute - [`Ash.Dsl.Attribute`](Ash.Dsl.Attribute.html)

* create\_timestamp - [`Ash.Dsl.CreateTimestamp`](Ash.Dsl.CreateTimestamp.html)

* update\_timestamp - [`Ash.Dsl.UpdateTimestamp`](Ash.Dsl.UpdateTimestamp.html)

 

[Link to this macro](#relationships/1 "Link to this macro")

relationships(body)

===================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "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`](Ash.Query.html#side_load/2)).

 Constructors

---------------

* has\_one - [`Ash.Dsl.HasOne`](Ash.Dsl.HasOne.html)

* has\_many - [`Ash.Dsl.HasMany`](Ash.Dsl.HasMany.html)

* many\_to\_many - [`Ash.Dsl.ManyToMany`](Ash.Dsl.ManyToMany.html)

* belongs\_to - [`Ash.Dsl.BelongsTo`](Ash.Dsl.BelongsTo.html)

 

[Link to this macro](#resource/1 "Link to this macro")

resource(body)

==============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "View Source")

(macro)

Resource-wide configuration

 Options

----------

* `:description`

 

[Link to this macro](#validations/1 "Link to this macro")

validations(body)

=================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "View Source")

(macro)

Declare validations prior to performing actions against the resource

 Constructors

---------------

* validate - [`Ash.Dsl.Validate`](Ash.Dsl.Validate.html)

 





Ash.Dsl.Attribute — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Attribute [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

=========================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[attribute(name, type, opts \\ [])](#attribute/3)

Declares an attribute on the resource

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#attribute/3 "Link to this macro")

attribute(name, type, opts \\ [])

=================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares an attribute on the resource

Type can be either a built in type (see [`Ash.Type`](Ash.Type.html)) for more, or a module

implementing the [`Ash.Type`](Ash.Type.html) behaviour.

 Examples

-----------

```

attribute :first\_name, :string, primary\_key?: true

```

 Arguments

------------

* `:name` - The name of the attribute.

* `:type` - The type of the attribute.

 Options

----------

* `: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. 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 `true`.

* `:update_default` - 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.

* `:default` - 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.

 





Ash.Dsl.BelongsTo — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.BelongsTo [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

=========================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[belongs\_to(name, destination, opts \\ [])](#belongs_to/3)

Declares a belongs\_to relationship. In a relational database, the foreign key would be on the *source* table.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#belongs_to/3 "Link to this macro")

belongs\_to(name, destination, opts \\ [])

==========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a belongs\_to relationship. In a relational database, the foreign key would be on the *source* table.

This creates a field on the resource with the corresponding name and type, unless `define_field?: false` is provided.

 Examples

-----------

```

# In a resource called `Word`

belongs\_to :dictionary\_entry, DictionaryEntry,

 source\_field: :text,

 destination\_field: :word\_text

```

 Arguments

------------

* `:name` - The name of the relationship

* `:destination` - The destination resource

 Options

----------

* `:primary_key?` - Whether this field is, or is part of, the primary key of a resource. The default value is `false`.

* `:define_field?` - If set to `false` a field is not created on the resource for this relationship, and one must be manually added in `attributes`. The default value is `true`.

* `:field_type` - The field type of the automatically created field. The default value is `:uuid`.

* `:destination_field` - The field on the related resource that should match the `source_field` on this resource. The default value is `:id`.

* `:source_field` - The field on this resource that should match the `destination_field` on the related resource. - Defaults to <name>\_id

* `:writable?` - Whether or not the relationship may be edited. The default value is `true`.

 





Ash.Dsl.Create — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Create [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

======================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[create(name, opts \\ [])](#create/2)

Declares a `create` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#create/2 "Link to this macro")

create(name, opts \\ [])

========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a `create` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation.

 Examples

-----------

```

create :register, primary?: true

```

 Arguments

------------

* `:name` - The name of the action

 Options

----------

* `:primary?` - Whether or not this action should be used when no action is specified by the caller. The default value is `false`.

 





Ash.Dsl.CreateTimestamp — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.CreateTimestamp [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

===============================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[create\_timestamp(name, opts \\ [])](#create_timestamp/2)

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

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#create_timestamp/2 "Link to this macro")

create\_timestamp(name, opts \\ [])

===================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

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

 Examples

-----------

```

create\_timestamp :inserted\_at

```

 Arguments

------------

* `:name` - The name of the attribute.

 Options

----------

* `:type` - 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. 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`.

* `:update_default` - 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.

* `:default` - 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`.

 





Ash.Dsl.Destroy — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Destroy [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

=======================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[destroy(name, opts \\ [])](#destroy/2)

Declares a `destroy` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#destroy/2 "Link to this macro")

destroy(name, opts \\ [])

=========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a `destroy` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation.

 Examples

-----------

```

destroy :soft\_delete, primary?: true

```

 Arguments

------------

* `:name` - The name of the action

 Options

----------

* `:primary?` - Whether or not this action should be used when no action is specified by the caller. The default value is `false`.

 





Ash.Dsl.Entity — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Entity [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/entity.ex#L1 "View Source")

=================================================================================================================================

Declares a DSL entity.

A dsl entity represents a dsl constructor who's resulting value is a struct.

This lets the user create complex objects with arbitrary(mostly) validation rules.

The lifecycle of creating entities is complex, happening as Elixir is compiling

the modules in question. Some of the patterns around validating/transforming entities

have not yet solidified. If you aren't careful and don't follow the guidelines listed

here, you can have subtle and strange bugs during compilation. Anything not isolated to

simple value validations should be done in `transformers`. See [`Ash.Dsl.Transformer`](Ash.Dsl.Transformer.html).

An entity has a `target` indicating which struct will ultimately be built. An entity

also has a `schema`. This schema is used for documentation, and the options are validated

against it before continuing on with the DSL.

To create positional arguments to the builder, use `args`. The values provided to

`args` need to be in the provided schema as well. They will be positional arguments

in the same order that they are provided in the `args` key.

`auto_set_fields` will set the provided values into the produced struct (they do not need

to be included in the schema).

`transform` is a function that takes a created struct and can alter it. This happens immediately

after handling the DSL options, and can be useful for setting field values on a struct based on

other values in that struct. If you need things that aren't contained in that struct, use an

[`Ash.Dsl.Transformer`](Ash.Dsl.Transformer.html).

`entities` allows you to specify a keyword list of nested entities. Nested entities are stored

on the struct in the corresponding key, and are used in the same way entities are otherwise.

For a full example, see [`Ash.Dsl.Extension`](Ash.Dsl.Extension.html).

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Functions](#functions)

------------------------

[build(map, opts, nested\_entities)](#build/3)

[describe(entity, depth \\ 2)](#describe/2)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/entity.ex#L47 "View Source")

Specs

-----

```

t() :: %Ash.Dsl.Entity{

  args: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()],

  auto_set_fields: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)(),

  describe: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(),

  entities: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)(),

  examples: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()],

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  schema: [NimbleOptions.schema](https://hexdocs.pm/nimble_options/NimbleOptions.html#t:schema/0)(),

  target: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  transform: [mfa](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil

}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#build/3 "Link to this function")

build(map, opts, nested\_entities)

==================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/entity.ex#L59 "View Source")

[Link to this function](#describe/2 "Link to this function")

describe(entity, depth \\ 2)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/entity.ex#L80 "View Source")





Ash.Dsl.Extension — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Extension behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L1 "View Source")

=================================================================================================================================================

An extension to the Ash DSL.

This allows configuring custom DSL components, whos configurations

can then be read back.

The example at the bottom shows how you might build a (not very contextually

relevant) DSL extension that would be used like so:

```

defmodule MyApp.MyResource do

 use Ash.Resource,

 extensions: [MyApp.CarExtension]

 cars do

 car :mazda, "6", trim: :touring

 car :toyota, "corolla"

 end

end

```

For (a not very contextually relevant) example:

```

defmodule MyApp.CarExtension do

 @car\_schema [

 make: [

 type: :atom,

 required: true,

 doc: "The make of the car"

 ],

 model: [

 type: :atom,

 required: true,

 doc: "The model of the car"

 ],

 type: [

 type: :atom,

 required: true,

 doc: "The type of the car",

 default: :sedan

 ]

 ]

 @car %Ash.Dsl.Entity{

 name: :car,

 describe: "Adds a car",

 examples: [

 "car :mazda, "6""

 ],

 target: MyApp.Car,

 args: [:make, :model],

 schema: @car\_schema

 }

 @cars %Ash.Dsl.Section{

 name: :cars, # The DSL constructor will be `cars`

 describe: """

 Configure what cars are available.

 More, deeper explanation. Always have a short one liner explanation,

 an empty line, and then a longer explanation.

 """,

 entities: [

 @car # See `Ash.Dsl.Entity` docs

 ],

 schema: [

 default\_manufacturer: [

 type: :atom,

 doc: "The default manufacturer"

 ]

 ]

 }

 use Ash.Dsl.Extension, sections: [@cars]

end

```

Often, we will need to do complex validation/validate based on the configuration

of other resources. Due to the nature of building compile time DSLs, there are

many restrictions around that process. To support these complex use cases, extensions

can include `transformers` which can validate/transform the DSL state after all basic

sections/entities have been created. See [`Ash.Dsl.Transformer`](Ash.Dsl.Transformer.html) for more information.

Transformers are provided as an option to `use`, like so:

```

use Ash.Dsl.Extension, sections: [@cars], transformers: [

 MyApp.Transformers.ValidateNoOverlappingMakesAndModels

]

```

To expose the configuration of your DSL, define functions that use the

helpers like [`get_entities/2`](#get_entities/2) and `get_opt/3`. For example:

```

defmodule MyApp.Cars do

 def cars(resource) do

 Ash.Dsl.Extension.get\_entities(resource, [:cars])

 end

end

MyApp.Cars.cars(MyResource)

# [%MyApp.Car{...}, %MyApp.Car{...}]

```

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[get\_entities(resource, path)](#get_entities/2)

Get the entities configured for a given section

[get\_opt(resource, path, value, default, configurable? \\ false)](#get_opt/5)

Get an option value for a section at a given path.

[get\_opt\_config(resource, path, value)](#get_opt_config/3)

[import\_mods(mods)](#import_mods/1)

[load()](#load/0)

[run\_transformers(mod, transformers, ash\_dsl\_config)](#run_transformers/3)

[unimport\_mods(mods)](#unimport_mods/1)

[Callbacks](#callbacks)

------------------------

[sections()](#c:sections/0)

[transformers()](#c:transformers/0)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#get_entities/2 "Link to this function")

get\_entities(resource, path)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L105 "View Source")

Get the entities configured for a given section

 

[Link to this function](#get_opt/5 "Link to this function")

get\_opt(resource, path, value, default, configurable? \\ false)

================================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L114 "View Source")

Get an option value for a section at a given path.

Checks to see if it has been overridden via configuration.

 

[Link to this function](#get_opt_config/3 "Link to this function")

get\_opt\_config(resource, path, value)

=======================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L136 "View Source")

[Link to this macro](#import_mods/1 "Link to this macro")

import\_mods(mods)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L738 "View Source")

(macro)

[Link to this macro](#load/0 "Link to this macro")

load()

======

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L246 "View Source")

(macro)

[Link to this function](#run_transformers/3 "Link to this function")

run\_transformers(mod, transformers, ash\_dsl\_config)

======================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L255 "View Source")

[Link to this macro](#unimport_mods/1 "Link to this macro")

unimport\_mods(mods)

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L746 "View Source")

(macro)

[Link to this section](#callbacks)

Callbacks

=============================================

[Link to this callback](#c:sections/0 "Link to this callback")

sections()

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L101 "View Source")

Specs

-----

```

sections() :: [[Ash.Dsl.Section.t](Ash.Dsl.Section.html#t:t/0)()]

```

[Link to this callback](#c:transformers/0 "Link to this callback")

transformers()

==============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L102 "View Source")

Specs

-----

```

transformers() :: [[module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()]

```





Ash.Dsl.HasMany — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.HasMany [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

=======================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[has\_many(name, destination, opts \\ [])](#has_many/3)

Declares a has\_many relationship. There can be any number of related entities.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#has_many/3 "Link to this macro")

has\_many(name, destination, opts \\ [])

========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a has\_many relationship. There can be any number of related entities.

 Examples

-----------

```

# In a resource called `Word`

has\_many :definitions, DictionaryDefinition,

 source\_field: :text,

 destination\_field: :word\_text

```

 Arguments

------------

* `:name` - The name of the relationship

* `:destination` - The destination resource

 Options

----------

* `:destination_field` - Required. The field on the related resource that should match the `source_field` on this resource.

* `:source_field` - The field on this resource that should match the `destination_field` on the related resource. The default value is `:id`.

* `:writable?` - Whether or not the relationship may be edited. The default value is `true`.

 





Ash.Dsl.HasOne — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.HasOne [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

======================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[has\_one(name, destination, opts \\ [])](#has_one/3)

Declares a has\_one relationship. In a relationsal database, the foreign key would be on the *other* table.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#has_one/3 "Link to this macro")

has\_one(name, destination, opts \\ [])

=======================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a has\_one relationship. In a relationsal database, the foreign key would be on the *other* table.

Generally speaking, a `has_one` also implies that the destination table is unique on that foreign key.

 Examples

-----------

```

# In a resource called `Word`

has\_one :dictionary\_entry, DictionaryEntry,

 source\_field: :text,

 destination\_field: :word\_text

```

 Arguments

------------

* `:name` - The name of the relationship

* `:destination` - The destination resource

 Options

----------

* `:destination_field` - Required. The field on the related resource that should match the `source_field` on this resource.

* `:source_field` - The field on this resource that should match the `destination_field` on the related resource. The default value is `:id`.

* `:writable?` - Whether or not the relationship may be edited. The default value is `true`.

 





Ash.Dsl.ManyToMany — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.ManyToMany [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

==========================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[many\_to\_many(name, destination, opts \\ [])](#many_to_many/3)

Declares a many\_to\_many relationship. Many to many relationships require a join table.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#many_to_many/3 "Link to this macro")

many\_to\_many(name, destination, opts \\ [])

=============================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a many\_to\_many relationship. Many to many relationships require a join table.

A join table is typically a table who's primary key consists of one foreign key to each resource.

 Examples

-----------

```

# In a resource called `Word`

many\_to\_many :books, Book,

 through: BookWord,

 source\_field: :text,

 source\_field\_on\_join\_table: :word\_text,

 destination\_field: :id,

 destination\_field\_on\_join\_table: :book\_id

```

 Arguments

------------

* `:name` - The name of the relationship

* `:destination` - The destination resource

 Options

----------

* `:source_field_on_join_table` - Required. The field on the join table that should line up with `source_field` on this resource.

* `:destination_field_on_join_table` - Required. The field on the join table that should line up with `destination_field` on the related resource. Default: [relationshihp\_name]\_id

* `:through` - Required. The resource to use as the join resource.

* `:join_relationship` - The has\_many relationship to the join table. Defaults to <relationship\_name>\_join\_assoc

* `:join_attributes` - Attributes to expose as editable when modifying the relationship.

Extensions may use this when deciding what fields to render from the join table.

See [`Ash.Changeset.append_to_relationship/3`](Ash.Changeset.html#append_to_relationship/3) and [`Ash.Changeset.replace_relationship/3`](Ash.Changeset.html#replace_relationship/3) for

how to edit these fields. The default value is `[]`.

* `:destination_field` - The field on the related resource that should match the `source_field` on this resource. The default value is `:id`.

* `:source_field` - The field on this resource that should match the `destination_field` on the related resource. The default value is `:id`.

* `:writable?` - Whether or not the relationship may be edited. The default value is `true`.

 





Ash.Dsl.Read — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Read [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

====================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[read(name, opts \\ [])](#read/2)

Declares a `read` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#read/2 "Link to this macro")

read(name, opts \\ [])

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a `read` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation.

 Examples

-----------

```

read :read\_all, primary?: true

```

 Arguments

------------

* `:name` - The name of the action

 Options

----------

* `:primary?` - Whether or not this action should be used when no action is specified by the caller. The default value is `false`.

 





Ash.Dsl.Section — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Section [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/section.ex#L1 "View Source")

===================================================================================================================================

Declares a DSL section.

A dsl section allows you to organize related configurations. All extensions

configure sections, they cannot add DSL builders to the top level. This

keeps things organized, and concerns separated.

A section may have nested sections, which will be configured the same as other sections.

Getting the options/entities of a section is done by providing a path, so you would

use the nested path to retrieve that configuration. See [`Ash.Dsl.Extension.get_entities/2`](Ash.Dsl.Extension.html#get_entities/2)

and [`Ash.Dsl.Extension.get_opt/4`](Ash.Dsl.Extension.html#get_opt/4).

A section may have entities, which are constructors that produce instances of structs.

For more on entities, see [`Ash.Dsl.Entity`](Ash.Dsl.Entity.html).

A section may also have a `schema`, which is a [`NimbleOptions`](https://hexdocs.pm/nimble_options/NimbleOptions.html) schema. Ash will produce

builders for those options, so that they may be configured. They are retrived with

[`Ash.Dsl.Extension.get_opt/4`](Ash.Dsl.Extension.html#get_opt/4).

For a full example, see [`Ash.Dsl.Extension`](Ash.Dsl.Extension.html).

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Functions](#functions)

------------------------

[describe(mod, section, depth \\ 2)](#describe/3)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/section.ex#L33 "View Source")

Specs

-----

```

t() :: %Ash.Dsl.Section{

  configurable: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()],

  describe: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(),

  entities: [[Ash.Dsl.Entity.t](Ash.Dsl.Entity.html#t:t/0)()],

  imports: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  schema: [NimbleOptions.schema](https://hexdocs.pm/nimble_options/NimbleOptions.html#t:schema/0)(),

  sections: [

    %Ash.Dsl.Section{

      configurable: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

      describe: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

      entities: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

      imports: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

      name: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

      schema: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

      sections: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

    }

  ]

}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#describe/3 "Link to this function")

describe(mod, section, depth \\ 2)

==================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/section.ex#L42 "View Source")





Ash.Dsl.Transformer — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Transformer behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L1 "View Source")

=====================================================================================================================================================

A transformer manipulates and/or validates the entire DSL state of a resource.

It's `transform/2` takes a `map`, which is just the values/configurations at each point

of the DSL. Don't manipulate it directly, if possible, instead use functions like

`get_entities/3` and `replace_entity/5` to manipulate it.

Use the `after?/1` and `before?/1` callbacks to ensure that your transformer

runs either before or after some other transformer.

The pattern for requesting information from other modules that use the DSL and are

also currently compiling has not yet been determined. If you have that requirement

you will need extra utilities to ensure that some other DSL based module has either

completed or reached a certain point in its transformers. These utilities have not

yet been written.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[add\_entity(dsl\_state, path, entity)](#add_entity/3)

[build\_before\_after\_list(transformer, transformers, already\_touched \\ [])](#build_before_after_list/3)

[build\_entity(extension, path, name, opts)](#build_entity/4)

[compare(arg1, arg2)](#compare/2)

[get\_entities(dsl\_state, path)](#get_entities/2)

[get\_option(dsl\_state, path, option)](#get_option/3)

[persist(dsl, key, value)](#persist/3)

[replace\_entity(dsl\_state, path, replacement, matcher)](#replace_entity/4)

[sort(transformers)](#sort/1)

[wait\_for\_transformer(resource, transformers, timeout \\ :timer.seconds(15), wait \\ 50)](#wait_for_transformer/4)

[Callbacks](#callbacks)

------------------------

[after?(module)](#c:after?/1)

[before?(module)](#c:before?/1)

[compile\_time\_only?()](#c:compile_time_only?/0)

[transform(module, map)](#c:transform/2)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#add_entity/3 "Link to this function")

add\_entity(dsl\_state, path, entity)

=====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L79 "View Source")

[Link to this function](#build_before_after_list/3 "Link to this function")

build\_before\_after\_list(transformer, transformers, already\_touched \\ [])

=============================================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L126 "View Source")

[Link to this function](#build_entity/4 "Link to this function")

build\_entity(extension, path, name, opts)

==========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L59 "View Source")

[Link to this function](#compare/2 "Link to this function")

compare(arg1, arg2)

===================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L148 "View Source")

[Link to this function](#get_entities/2 "Link to this function")

get\_entities(dsl\_state, path)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L87 "View Source")

[Link to this function](#get_option/3 "Link to this function")

get\_option(dsl\_state, path, option)

=====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L93 "View Source")

[Link to this function](#persist/3 "Link to this function")

persist(dsl, key, value)

========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L55 "View Source")

[Link to this function](#replace_entity/4 "Link to this function")

replace\_entity(dsl\_state, path, replacement, matcher)

=======================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L101 "View Source")

[Link to this function](#sort/1 "Link to this function")

sort(transformers)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L119 "View Source")

[Link to this function](#wait_for_transformer/4 "Link to this function")

wait\_for\_transformer(resource, transformers, timeout \\ :timer.seconds(15), wait \\ 50)

=========================================================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L35 "View Source")

[Link to this section](#callbacks)

Callbacks

=============================================

[Link to this callback](#c:after?/1 "Link to this callback")

after?(module)

==============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L20 "View Source")

Specs

-----

```

after?([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this callback](#c:before?/1 "Link to this callback")

before?(module)

===============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L19 "View Source")

Specs

-----

```

before?([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this callback](#c:compile_time_only?/0 "Link to this callback")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L21 "View Source")

Specs

-----

```

compile_time_only?() :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this callback](#c:transform/2 "Link to this callback")

transform(module, map)

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L18 "View Source")

Specs

-----

```

transform([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: {:ok, [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :halt

```





Ash.Dsl.Update — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Update [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

======================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[update(name, opts \\ [])](#update/2)

Declares a `update` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#update/2 "Link to this macro")

update(name, opts \\ [])

========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a `update` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation.

 Examples

-----------

```

update :flag\_for\_review, primary?: true

```

 Arguments

------------

* `:name` - The name of the action

 Options

----------

* `:primary?` - Whether or not this action should be used when no action is specified by the caller. The default value is `false`.

 





Ash.Dsl.UpdateTimestamp — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.UpdateTimestamp [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

===============================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[update\_timestamp(name, opts \\ [])](#update_timestamp/2)

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

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#update_timestamp/2 "Link to this macro")

update\_timestamp(name, opts \\ [])

===================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "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` - 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. 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`.

* `:update_default` - 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` - 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`.

 





Ash.Dsl.Validate — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Dsl.Validate [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

========================================================================================================================================

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[validate(validation, opts \\ [])](#validate/2)

Declares a validation for creates and updates.

[Link to this section](#functions)

Functions

=============================================

[Link to this macro](#validate/2 "Link to this macro")

validate(validation, opts \\ [])

================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source")

(macro)

Declares a validation for creates and updates.

 Examples

-----------

```

validate {Mod, [foo: :bar]}

```

```

validate at\_least\_one\_of\_present([:first\_name, :last\_name])

```

 Arguments

------------

* `:validation` - The module/opts pair of the validation

 Options

----------

* `:on` - The action types the validation should run on.

Many validations don't make sense in the context of deletion, so by default it is left out of the list. The default value is `[:create, :update]`.

* `:expensive?` - If a validation is expensive, it won't be run on invalid changes. All inexpensive validations are always run, to provide informative validations. The default value is `false`.

 





Ash.Error.Changes.InvalidAttribute — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Changes.InvalidAttribute exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/invalid_attribute.ex#L1 "View Source")

====================================================================================================================================================================================

Used when an invalid value is provided for an attribute change

 





Ash.Error.Changes.InvalidChanges — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Changes.InvalidChanges exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/invalid_changes.ex#L1 "View Source")

================================================================================================================================================================================

Used when a change is provided that covers multiple attributes/relationships

 





Ash.Error.Changes.InvalidRelationship — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Changes.InvalidRelationship exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/invalid_relationship.ex#L1 "View Source")

==========================================================================================================================================================================================

Used when an invalid value is provided for a relationship change

 





Ash.Error.Changes.NoSuchAttribute — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Changes.NoSuchAttribute exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/no_such_attribute.ex#L1 "View Source")

===================================================================================================================================================================================

Used when a change is provided for an attribute that does not exist

 





Ash.Error.Changes.NoSuchRelationship — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Changes.NoSuchRelationship exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/no_such_relationship.ex#L1 "View Source")

=========================================================================================================================================================================================

Used when a change is provided for an relationship that does not exist

 





Ash.Error.Changes.UnknownError — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Changes.UnknownError exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/unknown_error.ex#L1 "View Source")

============================================================================================================================================================================

Used when a change fails for an unknown reason

 





Ash.Error.Dsl.DslError — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Dsl.DslError exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/dsl/dsl_error.ex#L1 "View Source")

============================================================================================================================================================

Used when a DSL is incorrectly configured.

 





Ash.Error.Filter.InvalidFilterValue — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Filter.InvalidFilterValue exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/invalid_filter_value.ex#L1 "View Source")

=======================================================================================================================================================================================

Used when an invalid value is provided for a filter

 





Ash.Error.Filter.NoSuchAttributeOrRelationship — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Filter.NoSuchAttributeOrRelationship exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/no_such_attribute_or_relationship.ex#L1 "View Source")

===============================================================================================================================================================================================================

Used when a key in a filter contains something that is neither an attribute or a relationship

 





Ash.Error.Filter.NoSuchFilterPredicate — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Filter.NoSuchFilterPredicate exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/no_such_filter_predicate.ex#L1 "View Source")

==============================================================================================================================================================================================

Used when a filter predicate that does not exist is referenced

 





Ash.Error.Filter.ReadActionRequired — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Filter.ReadActionRequired exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/read_action_required.ex#L1 "View Source")

=======================================================================================================================================================================================

Used when a relationship is filtered and the destination does not have a default read action

 





Ash.Error.Filter.UnsupportedPredicate — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Filter.UnsupportedPredicate exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/unsupported_predicate.ex#L1 "View Source")

==========================================================================================================================================================================================

Used when the datalayer does not support a provided predicate

 





Ash.Error.Forbidden — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Forbidden exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/forbidden.ex#L1 "View Source")

=====================================================================================================================================================

Used when authorization for an action fails

 





Ash.Error.Forbidden.MustPassStrictCheck — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Forbidden.MustPassStrictCheck exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/forbidden/must_pass_strict_check.ex#L1 "View Source")

================================================================================================================================================================================================

Used when unreachable code/conditions are reached in the framework

 





Ash.Error.Framework — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Framework exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/framework.ex#L1 "View Source")

=====================================================================================================================================================

Used when an unknown/generic framework error occurs

 





Ash.Error.Framework.AssumptionFailed — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Framework.AssumptionFailed exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/framework/assumption_failed.ex#L1 "View Source")

========================================================================================================================================================================================

Used when unreachable code/conditions are reached in the framework

 





Ash.Error.Framework.SynchronousEngineStuck — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Framework.SynchronousEngineStuck exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/framework/synchronous_engine_stuck.ex#L1 "View Source")

=====================================================================================================================================================================================================

Used when the sycnrhonous engine cannot proceed

 





Ash.Error.Invalid — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Invalid exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid.ex#L1 "View Source")

=================================================================================================================================================

The top level invalid error

 





Ash.Error.Invalid.DuplicatedPath — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Invalid.DuplicatedPath exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/duplicated_path.ex#L1 "View Source")

================================================================================================================================================================================

Used when multiple requests with the same path are passed to the internal engine

 





Ash.Error.Invalid.ImpossiblePath — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Invalid.ImpossiblePath exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/impossible_path.ex#L1 "View Source")

================================================================================================================================================================================

Used when a request expresses a dependency on another request that doesn't exist

 





Ash.Error.Invalid.InvalidPrimaryKey — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Invalid.InvalidPrimaryKey exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/invalid_primary_key.ex#L1 "View Source")

=======================================================================================================================================================================================

Used when an invalid primary key is given to an Api's `get`

 





Ash.Error.Invalid.NoSuchAction — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Invalid.NoSuchAction exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/no_such_action.ex#L1 "View Source")

=============================================================================================================================================================================

Used when an action name is provided that doesn't exist

 





Ash.Error.Invalid.NoSuchResource — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Invalid.NoSuchResource exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/no_such_resource.ex#L1 "View Source")

=================================================================================================================================================================================

Used when a resource or alias is provided that doesn't exist

 





Ash.Error.Query.InvalidLimit — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Query.InvalidLimit exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/invalid_limit.ex#L1 "View Source")

========================================================================================================================================================================

Used when an invalid limit is provided

 





Ash.Error.Query.InvalidOffset — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Query.InvalidOffset exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/offset.ex#L1 "View Source")

==================================================================================================================================================================

Used when an invalid offset is provided

 





Ash.Error.Query.InvalidSortOrder — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Query.InvalidSortOrder exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/invalid_sort_order.ex#L1 "View Source")

=================================================================================================================================================================================

Used when an invalid sort order is provided

 





Ash.Error.Query.NoSuchAttribute — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Query.NoSuchAttribute exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/no_such_attribute.ex#L1 "View Source")

===============================================================================================================================================================================

Used when an attribute that doesn't exist is used in a query

 





Ash.Error.Query.UnsortableAttribute — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Query.UnsortableAttribute exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/unsortable_field.ex#L1 "View Source")

==================================================================================================================================================================================

Used when attempting to sort on a field that cannot be used for sorting

 





Ash.Error.SideLoad.InvalidQuery — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.SideLoad.InvalidQuery exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/side_load/invalid_query.ex#L1 "View Source")

===============================================================================================================================================================================

Used when an invalid query is provided in a side load

 





Ash.Error.SideLoad.NoSuchRelationship — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.SideLoad.NoSuchRelationship exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/side_load/no_such_relationship.ex#L1 "View Source")

============================================================================================================================================================================================

Used when attempting to side load a relationship that does not exist

 





Ash.Error.Unknown — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Error.Unknown exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/unknown.ex#L1 "View Source")

=================================================================================================================================================

The top level unknown error container

 





Ash.Filter — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L1 "View Source")

================================================================================================================================

The representation of a filter in Ash.

Ash filters are stored as nested `Ash.Filter.Expression{}` and `%Ash.Filter.Not{}` structs,

terminating in a `%Ash.Filter.Predicate{}` struct. An expression is simply a boolean operator

and the left and right hand side of that operator.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[add\_to\_filter(base, op \\ :and, addition)](#add_to_filter/3)

[add\_to\_filter!(base, op \\ :and, addition)](#add_to_filter!/3)

[do\_map(expression, func)](#do_map/2)

[do\_reduce(expression, acc, func)](#do_reduce/3)

[filter\_expression\_by\_relationship\_path(filter, path, scope? \\ false)](#filter_expression_by_relationship_path/3)

[map(filter, func)](#map/2)

[parse(resource, statement)](#parse/2)

[parse!(resource, statement)](#parse!/2)

[read\_requests(api, filter)](#read_requests/2)

[reduce(filter, acc \\ nil, func)](#reduce/3)

[relationship\_filter\_request\_paths(filter)](#relationship_filter_request_paths/1)

[relationship\_paths(filter\_or\_expression, kind \\ :all)](#relationship_paths/2)

[run\_other\_data\_layer\_filters(api, resource, filter)](#run_other_data_layer_filters/3)

[strict\_subset\_of(filter, candidate)](#strict_subset_of/2)

Returns true if the second argument is a strict subset (always returns the same or less data) of the first

[strict\_subset\_of?(filter, candidate)](#strict_subset_of?/2)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#add_to_filter/3 "Link to this function")

add\_to\_filter(base, op \\ :and, addition)

===========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L248 "View Source")

[Link to this function](#add_to_filter!/3 "Link to this function")

add\_to\_filter!(base, op \\ :and, addition)

============================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L238 "View Source")

[Link to this function](#do_map/2 "Link to this function")

do\_map(expression, func)

=========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L346 "View Source")

[Link to this function](#do_reduce/3 "Link to this function")

do\_reduce(expression, acc, func)

=================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L399 "View Source")

[Link to this function](#filter_expression_by_relationship_path/3 "Link to this function")

filter\_expression\_by\_relationship\_path(filter, path, scope? \\ false)

=========================================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L489 "View Source")

[Link to this function](#map/2 "Link to this function")

map(filter, func)

=================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L334 "View Source")

[Link to this function](#parse/2 "Link to this function")

parse(resource, statement)

==========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L43 "View Source")

[Link to this function](#parse!/2 "Link to this function")

parse!(resource, statement)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L33 "View Source")

[Link to this function](#read_requests/2 "Link to this function")

read\_requests(api, filter)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L299 "View Source")

[Link to this function](#reduce/3 "Link to this function")

reduce(filter, acc \\ nil, func)

================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L362 "View Source")

[Link to this function](#relationship_filter_request_paths/1 "Link to this function")

relationship\_filter\_request\_paths(filter)

============================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L293 "View Source")

[Link to this function](#relationship_paths/2 "Link to this function")

relationship\_paths(filter\_or\_expression, kind \\ :all)

=========================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L222 "View Source")

[Link to this function](#run_other_data_layer_filters/3 "Link to this function")

run\_other\_data\_layer\_filters(api, resource, filter)

=======================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L58 "View Source")

[Link to this function](#strict_subset_of/2 "Link to this function")

strict\_subset\_of(filter, candidate)

=====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L277 "View Source")

Returns true if the second argument is a strict subset (always returns the same or less data) of the first

 

[Link to this function](#strict_subset_of?/2 "Link to this function")

strict\_subset\_of?(filter, candidate)

======================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L289 "View Source")





Ash.Filter.Expression — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter.Expression [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/expression.ex#L1 "View Source")

===============================================================================================================================================

Represents a boolean expression

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[new(op, left, right)](#new/3)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#new/3 "Link to this function")

new(op, left, right)

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/expression.ex#L6 "View Source")





Ash.Filter.Not — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter.Not [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/not.ex#L1 "View Source")

=================================================================================================================================

Represents the negation of the contained expression

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[new(expression)](#new/1)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#new/1 "Link to this function")

new(expression)

===============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/not.ex#L7 "View Source")





Ash.Filter.Predicate — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter.Predicate behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L1 "View Source")

=======================================================================================================================================================

Represents a filter predicate

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[comparison()](#t:comparison/0)

[predicate()](#t:predicate/0)

[t()](#t:t/0)

[Functions](#functions)

------------------------

[add\_inspect\_path(inspect\_opts, field)](#add_inspect_path/2)

[compare(pred, right)](#compare/2)

[match?(predicate, value, type)](#match?/3)

[new(resource, attribute, predicate, value, relationship\_path)](#new/5)

[Callbacks](#callbacks)

------------------------

[compare(predicate, predicate)](#c:compare/2)

[match?(predicate, term, arg3)](#c:match?/3)

[new(arg1, arg2, term)](#c:new/3)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:comparison/0 "Link to this type")

comparison()

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L12 "View Source")

Specs

-----

```

comparison() ::

  :unknown

  | :right_excludes_left

  | :left_excludes_right

  | :right_includes_left

  | :left_includes_right

  | :mutually_inclusive

  | {:simplify, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

  | {:simplify, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```

[Link to this type](#t:predicate/0 "Link to this type")

predicate()

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L10 "View Source")

Specs

-----

```

predicate() :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L23 "View Source")

Specs

-----

```

t() :: %Ash.Filter.Predicate{

  attribute: [Ash.attribute](Ash.html#t:attribute/0)(),

  predicate: [predicate](#t:predicate/0)(),

  relationship_path: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()],

  resource: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  value: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#add_inspect_path/2 "Link to this function")

add\_inspect\_path(inspect\_opts, field)

========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L134 "View Source")

[Link to this function](#compare/2 "Link to this function")

compare(pred, right)

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L52 "View Source")

Specs

-----

```

compare([predicate](#t:predicate/0)(), [predicate](#t:predicate/0)()) :: [comparison](#t:comparison/0)()

```

[Link to this function](#match?/3 "Link to this function")

match?(predicate, value, type)

==============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L47 "View Source")

[Link to this function](#new/5 "Link to this function")

new(resource, attribute, predicate, value, relationship\_path)

==============================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L105 "View Source")

[Link to this section](#callbacks)

Callbacks

=============================================

[Link to this callback](#c:compare/2 "Link to this callback")

compare(predicate, predicate)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L30 "View Source")

Specs

-----

```

compare([predicate](#t:predicate/0)(), [predicate](#t:predicate/0)()) :: [comparison](#t:comparison/0)()

```

[Link to this callback](#c:match?/3 "Link to this callback")

match?(predicate, term, arg3)

=============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L31 "View Source")

Specs

-----

```

match?([predicate](#t:predicate/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [Ash.Type.t](Ash.Type.html#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | :unknown

```

[Link to this callback](#c:new/3 "Link to this callback")

new(arg1, arg2, term)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L29 "View Source")

Specs

-----

```

new([Ash.resource](Ash.html#t:resource/0)(), [Ash.attribute](Ash.html#t:attribute/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) ::

  {:ok, [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}

```





Ash.Filter.Predicate.Eq — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter.Predicate.Eq [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/eq.ex#L1 "View Source")

===================================================================================================================================================

A predicate for strict value equality

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[new(resource, attribute, value)](#new/3)

Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#new/3 "Link to this function")

new(resource, attribute, value)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/eq.ex#L10 "View Source")

Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3).

 





Ash.Filter.Predicate.GreaterThan — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter.Predicate.GreaterThan [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/greater_than.ex#L1 "View Source")

======================================================================================================================================================================

A predicate for a value being greater than the provided value

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[new(resource, attribute, value)](#new/3)

Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#new/3 "Link to this function")

new(resource, attribute, value)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/greater_than.ex#L11 "View Source")

Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3).

 





Ash.Filter.Predicate.In — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter.Predicate.In [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/in.ex#L1 "View Source")

===================================================================================================================================================

A predicate for a value being in a list of provided values

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[new(resource, attribute, values)](#new/3)

Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#new/3 "Link to this function")

new(resource, attribute, values)

================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/in.ex#L12 "View Source")

Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3).

 





Ash.Filter.Predicate.LessThan — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter.Predicate.LessThan [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/less_than.ex#L1 "View Source")

================================================================================================================================================================

A predicate for a value being greater than the provided value

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[new(resource, attribute, value)](#new/3)

Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#new/3 "Link to this function")

new(resource, attribute, value)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/less_than.ex#L11 "View Source")

Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3).

 





Ash.Filter.Runtime — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Filter.Runtime [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/runtime.ex#L1 "View Source")

=========================================================================================================================================

Checks a record to see if it matches a filter statement.

We can't always tell if a record matches a filter statement, and as such

this function may return `:unknown`

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[matches?(api, record, filter, dirty\_fields \\ [])](#matches?/4)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#matches?/4 "Link to this function")

matches?(api, record, filter, dirty\_fields \\ [])

==================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/runtime.ex#L10 "View Source")





Ash.Query — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Query [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L1 "View Source")

=======================================================================================================================

Utilties around constructing/manipulating ash queries.

Ash queries are used for read actions and side loads, and ultimately

map to queries to a resource's data layer.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Functions](#functions)

------------------------

[do\_validate\_side\_load(resource, query, path)](#do_validate_side_load/3)

[filter(query, filter)](#filter/2)

[limit(query, limit)](#limit/2)

Limit the results returned from the query

[new(resource, api \\ nil)](#new/2)

Create a new query.

[offset(query, offset)](#offset/2)

Skip the first n records

[set\_api(query, api)](#set_api/2)

Set the query's api, and any side loaded query's api

[side\_load(query, statement)](#side_load/2)

Side loads related entities

[sort(query, sorts)](#sort/2)

[unset(query, keys)](#unset/2)

[validate\_side\_load(resource, side\_loads, path \\ [])](#validate_side_load/3)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L21 "View Source")

Specs

-----

```

t() :: %Ash.Query{

  api: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  data_layer_query: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  errors: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  filter: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  limit: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  offset: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  resource: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  side_load: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  sort: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  valid?: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#do_validate_side_load/3 "Link to this function")

do\_validate\_side\_load(resource, query, path)

===============================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L137 "View Source")

[Link to this function](#filter/2 "Link to this function")

filter(query, filter)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L186 "View Source")

[Link to this function](#limit/2 "Link to this function")

limit(query, limit)

===================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L87 "View Source")

Limit the results returned from the query

 

[Link to this function](#new/2 "Link to this function")

new(resource, api \\ nil)

=========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L71 "View Source")

Create a new query.

 

[Link to this function](#offset/2 "Link to this function")

offset(query, offset)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L101 "View Source")

Skip the first n records

 

[Link to this function](#set_api/2 "Link to this function")

set\_api(query, api)

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L81 "View Source")

Set the query's api, and any side loaded query's api

 

[Link to this function](#side_load/2 "Link to this function")

side\_load(query, statement)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L117 "View Source")

Side loads related entities

 

[Link to this function](#sort/2 "Link to this function")

sort(query, sorts)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L230 "View Source")

[Link to this function](#unset/2 "Link to this function")

unset(query, keys)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L245 "View Source")

[Link to this function](#validate_side_load/3 "Link to this function")

validate\_side\_load(resource, side\_loads, path \\ [])

=======================================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L130 "View Source")





Ash.Resource — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L1 "View Source")

=============================================================================================================================

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

Resource DSL documentation: [`Ash.Dsl`](Ash.Dsl.html)

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[action(resource, name, type)](#action/3)

Returns the action with the matching name and type on the resource

[actions(resource)](#actions/1)

Returns all actions of a resource

[attribute(resource, name)](#attribute/2)

Get an attribute name from the resource

[attributes(resource)](#attributes/1)

Returns all attributes of a resource

[authorizers(resource)](#authorizers/1)

A list of authorizers to be used when accessing

[data\_layer(resource)](#data_layer/1)

The data layer of the resource, or nil if it does not have one

[data\_layer\_can?(resource, feature)](#data_layer_can?/2)

Whether ornot the data layer supports a specific feature

[data\_layer\_filters(resource)](#data_layer_filters/1)

Custom filters suppoted by the data layer of the resource

[in\_transaction?(resource)](#in_transaction?/1)

Whether or not the data layer for the resource is currently in a transaction

[primary\_action(resource, type)](#primary_action/2)

Returns the primary action of a given type

[primary\_action!(resource, type)](#primary_action!/2)

Returns the primary action of the given type

[primary\_key(resource)](#primary_key/1)

A list of field names corresponding to the primary key

[related(resource, relationship)](#related/2)

[relationship(resource, relationship\_name)](#relationship/2)

Get a relationship by name or path

[relationships(resource)](#relationships/1)

[resource?(module)](#resource?/1)

Whether or not a given module is a resource module

[rollback(resource, term)](#rollback/2)

Rolls back the current transaction

[transaction(resource, func)](#transaction/2)

Wraps the execution of the function in a transaction with the resource's datalayer

[validations(resource)](#validations/1)

A list of all validations for the resource

[validations(resource, type)](#validations/2)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#action/3 "Link to this function")

action(resource, name, type)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L169 "View Source")

Specs

-----

```

action([Ash.resource](Ash.html#t:resource/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.action\_type](Ash.html#t:action_type/0)()) :: [Ash.action](Ash.html#t:action/0)() | nil

```

Returns the action with the matching name and type on the resource

 

[Link to this function](#actions/1 "Link to this function")

actions(resource)

=================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L163 "View Source")

Specs

-----

```

actions([Ash.resource](Ash.html#t:resource/0)()) :: [[Ash.action](Ash.html#t:action/0)()]

```

Returns all actions of a resource

 

[Link to this function](#attribute/2 "Link to this function")

attribute(resource, name)

=========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L183 "View Source")

Specs

-----

```

attribute([Ash.resource](Ash.html#t:resource/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [Ash.attribute](Ash.html#t:attribute/0)() | nil

```

Get an attribute name from the resource

 

[Link to this function](#attributes/1 "Link to this function")

attributes(resource)

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L177 "View Source")

Specs

-----

```

attributes([Ash.resource](Ash.html#t:resource/0)()) :: [[Ash.attribute](Ash.html#t:attribute/0)()]

```

Returns all attributes of a resource

 

[Link to this function](#authorizers/1 "Link to this function")

authorizers(resource)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L74 "View Source")

Specs

-----

```

authorizers([Ash.resource](Ash.html#t:resource/0)()) :: [[module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()]

```

A list of authorizers to be used when accessing

 

[Link to this function](#data_layer/1 "Link to this function")

data\_layer(resource)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L212 "View Source")

Specs

-----

```

data_layer([Ash.resource](Ash.html#t:resource/0)()) :: [Ash.data\_layer](Ash.html#t:data_layer/0)()

```

The data layer of the resource, or nil if it does not have one

 

[Link to this function](#data_layer_can?/2 "Link to this function")

data\_layer\_can?(resource, feature)

====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L218 "View Source")

Specs

-----

```

data_layer_can?([Ash.resource](Ash.html#t:resource/0)(), [Ash.DataLayer.feature](Ash.DataLayer.html#t:feature/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Whether ornot the data layer supports a specific feature

 

[Link to this function](#data_layer_filters/1 "Link to this function")

data\_layer\_filters(resource)

==============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L226 "View Source")

Specs

-----

```

data_layer_filters([Ash.resource](Ash.html#t:resource/0)()) :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()

```

Custom filters suppoted by the data layer of the resource

 

[Link to this function](#in_transaction?/1 "Link to this function")

in\_transaction?(resource)

==========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L232 "View Source")

Specs

-----

```

in_transaction?([Ash.resource](Ash.html#t:resource/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Whether or not the data layer for the resource is currently in a transaction

 

[Link to this function](#primary_action/2 "Link to this function")

primary\_action(resource, type)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L151 "View Source")

Specs

-----

```

primary_action([Ash.resource](Ash.html#t:resource/0)(), [Ash.action\_type](Ash.html#t:action_type/0)()) :: [Ash.action](Ash.html#t:action/0)() | nil

```

Returns the primary action of a given type

 

[Link to this function](#primary_action!/2 "Link to this function")

primary\_action!(resource, type)

================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L142 "View Source")

Specs

-----

```

primary_action!([Ash.resource](Ash.html#t:resource/0)(), [Ash.action\_type](Ash.html#t:action_type/0)()) :: [Ash.action](Ash.html#t:action/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Returns the primary action of the given type

 

[Link to this function](#primary_key/1 "Link to this function")

primary\_key(resource)

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L103 "View Source")

Specs

-----

```

primary_key([Ash.resource](Ash.html#t:resource/0)()) :: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]

```

A list of field names corresponding to the primary key

 

[Link to this function](#related/2 "Link to this function")

related(resource, relationship)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L197 "View Source")

Specs

-----

```

related([Ash.resource](Ash.html#t:resource/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()]) ::

  [Ash.resource](Ash.html#t:resource/0)() | nil

```

[Link to this function](#relationship/2 "Link to this function")

relationship(resource, relationship\_name)

==========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L114 "View Source")

Specs

-----

```

relationship([Ash.resource](Ash.html#t:resource/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]) :: [Ash.relationship](Ash.html#t:relationship/0)() | nil

```

Get a relationship by name or path

 

[Link to this function](#relationships/1 "Link to this function")

relationships(resource)

=======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L108 "View Source")

Specs

-----

```

relationships([Ash.resource](Ash.html#t:resource/0)()) :: [[Ash.relationship](Ash.html#t:relationship/0)()]

```

[Link to this function](#resource?/1 "Link to this function")

resource?(module)

=================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L95 "View Source")

Specs

-----

```

resource?([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Whether or not a given module is a resource module

 

[Link to this function](#rollback/2 "Link to this function")

rollback(resource, term)

========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L248 "View Source")

Specs

-----

```

rollback([Ash.resource](Ash.html#t:resource/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Rolls back the current transaction

 

[Link to this function](#transaction/2 "Link to this function")

transaction(resource, func)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L238 "View Source")

Specs

-----

```

transaction([Ash.resource](Ash.html#t:resource/0)(), (() -> [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)())) :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Wraps the execution of the function in a transaction with the resource's datalayer

 

[Link to this function](#validations/1 "Link to this function")

validations(resource)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L89 "View Source")

Specs

-----

```

validations([Ash.resource](Ash.html#t:resource/0)()) :: [[Ash.validation](Ash.html#t:validation/0)()]

```

A list of all validations for the resource

 

[Link to this function](#validations/2 "Link to this function")

validations(resource, type)

===========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L81 "View Source")

Specs

-----

```

validations([Ash.resource](Ash.html#t:resource/0)(), :create | :update | :destroy) :: [[Ash.validation](Ash.html#t:validation/0)()]

```





Ash.Resource.Actions.Create — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Actions.Create [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/create.ex#L1 "View Source")

===========================================================================================================================================================

Represents a create action on a resource.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/create.ex#L5 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Actions.Create{

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  primary?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  type: :create

}

```





Ash.Resource.Actions.Destroy — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Actions.Destroy [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/destroy.ex#L1 "View Source")

=============================================================================================================================================================

Represents a destroy action on a resource.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/destroy.ex#L6 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Actions.Destroy{

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  primary?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  type: :destroy

}

```





Ash.Resource.Actions.Read — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Actions.Read [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/read.ex#L1 "View Source")

=======================================================================================================================================================

Represents a read action on a resource.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/read.ex#L6 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Actions.Read{

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  primary?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  type: :read

}

```





Ash.Resource.Actions.Update — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Actions.Update [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/update.ex#L1 "View Source")

===========================================================================================================================================================

Represents a update action on a resource.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/update.ex#L6 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Actions.Update{

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  primary?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  type: :update

}

```





Ash.Resource.Relationships.BelongsTo — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Relationships.BelongsTo [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/belongs_to.ex#L1 "View Source")

==============================================================================================================================================================================

Represents a belongs\_to relationship on a resource

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/belongs_to.ex#L18 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Relationships.BelongsTo{

  cardinality: :one,

  define_field?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  destination: [Ash.resource](Ash.html#t:resource/0)(),

  destination_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  field_type: [Ash.Type.t](Ash.Type.html#t:t/0)(),

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  primary_key?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  source: [Ash.resource](Ash.html#t:resource/0)(),

  source_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil,

  type: :belongs_to,

  writable?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

}

```





Ash.Resource.Relationships.HasMany — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Relationships.HasMany [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/has_many.ex#L1 "View Source")

==========================================================================================================================================================================

Represents a has\_many relationship on a resource

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/has_many.ex#L14 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Relationships.HasMany{

  cardinality: :many,

  destination: [Ash.resource](Ash.html#t:resource/0)(),

  destination_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  source: [Ash.resource](Ash.html#t:resource/0)(),

  source_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  type: :has_many,

  writable?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

}

```





Ash.Resource.Relationships.HasOne — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Relationships.HasOne [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/has_one.ex#L1 "View Source")

========================================================================================================================================================================

Represents a has\_one relationship on a resource

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/has_one.ex#L16 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Relationships.HasOne{

  allow_orphans?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  cardinality: :one,

  destination: [Ash.resource](Ash.html#t:resource/0)(),

  destination_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  source: [Ash.resource](Ash.html#t:resource/0)(),

  source_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  type: :has_one,

  writable?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

}

```





Ash.Resource.Relationships.ManyToMany — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Relationships.ManyToMany [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/many_to_many.ex#L1 "View Source")

=================================================================================================================================================================================

Represents a many\_to\_many relationship on a resource

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[t()](#t:t/0)

[Functions](#functions)

------------------------

[transform(relationship)](#transform/1)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/many_to_many.ex#L19 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Relationships.ManyToMany{

  cardinality: :many,

  destination: [Ash.resource](Ash.html#t:resource/0)(),

  destination_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  destination_field_on_join_table: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  join_attributes: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()],

  join_relationship: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  source: [Ash.resource](Ash.html#t:resource/0)(),

  source_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  source_field_on_join_table: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(),

  through: [Ash.resource](Ash.html#t:resource/0)(),

  type: :many_to_many,

  writable?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#transform/1 "Link to this function")

transform(relationship)

=======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/many_to_many.ex#L87 "View Source")





Ash.Resource.Transformers.BelongsToAttribute — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Transformers.BelongsToAttribute [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L1 "View Source")

===============================================================================================================================================================================================

Creates the attribute for belongs\_to relationships that have `define_field?: true`

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(arg1)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(resource, dsl\_state)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(arg1)

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L44 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(resource, dsl\_state)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L12 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Resource.Transformers.BelongsToSourceField — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Transformers.BelongsToSourceField [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L1 "View Source")

====================================================================================================================================================================================================

Sets the default `source_field` for belongs\_to attributes

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(\_)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(resource, dsl\_state)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(\_)

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L5 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(resource, dsl\_state)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L10 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Resource.Transformers.CachePrimaryKey — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Transformers.CachePrimaryKey [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L1 "View Source")

=========================================================================================================================================================================================

Validates the primary key of a resource

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(arg1)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(resource, dsl\_state)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(arg1)

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L37 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L3 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L3 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(resource, dsl\_state)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L8 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Resource.Transformers.CreateJoinRelationship — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Transformers.CreateJoinRelationship [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L1 "View Source")

=======================================================================================================================================================================================================

Creates an automatically named `has_many` relationship for each many\_to\_many.

This will likely not be around for long, as our logic around many to many relationships

will update soon.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(\_)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(arg1)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(resource, dsl\_state)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(\_)

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L8 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(arg1)

=============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L36 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L8 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(resource, dsl\_state)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L14 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Resource.Transformers.SetPrimaryActions — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Transformers.SetPrimaryActions [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L1 "View Source")

=============================================================================================================================================================================================

Creates/validates the primary action configuration

If only one action of a given type is defined, it is marked

as primary. If multiple exist, and one is not primary,

this results in an error.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(\_)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(resource, dsl\_state)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(\_)

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L9 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L9 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L9 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(resource, dsl\_state)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L14 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Resource.Transformers.SetRelationshipSource — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Transformers.SetRelationshipSource [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L1 "View Source")

=====================================================================================================================================================================================================

Sets the `source` key on relationships to be the resource they were defined on

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[after?(\_)](#after?/1)

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

[before?(\_)](#before?/1)

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

[compile\_time\_only?()](#compile_time_only?/0)

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

[transform(resource, dsl\_state)](#transform/2)

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#after?/1 "Link to this function")

after?(\_)

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L3 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1).

 

[Link to this function](#before?/1 "Link to this function")

before?(\_)

===========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L3 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1).

 

[Link to this function](#compile_time_only?/0 "Link to this function")

compile\_time\_only?()

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L3 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0).

 

[Link to this function](#transform/2 "Link to this function")

transform(resource, dsl\_state)

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L7 "View Source")

Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2).

 





Ash.Resource.Validation — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Validation behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L1 "View Source")

=============================================================================================================================================================

Represents a validation in Ash.

See `Ash.Resource.Validation.Builtin` for a list of builtin validations.

To write your own validation, define a module that implements the [`init/1`](#c:init/1) callback

to validate options at compile time, and [`validate/2`](#c:validate/2) callback to do the validation.

Then, in a resource, you can say:

```

validations do

 validation {MyValidation, [foo: :bar]}

end

```

To make it more readable, you can define a function in the module that returns that tuple,

and import it into your resource.

```

defmodule MyValidation do

 def my\_validation(value) do

 {\_\_MODULE\_\_, foo: value}

 end

end

```

```

defmodule MyResource do

 ...

 import MyValidation

 validations do

 validate my\_validation(:foo)

 end

end

```

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[path()](#t:path/0)

[t()](#t:t/0)

[Functions](#functions)

------------------------

[on(list)](#on/1)

[opt\_schema()](#opt_schema/0)

[transform(validation)](#transform/1)

[validation(module)](#validation/1)

[Callbacks](#callbacks)

------------------------

[init(arg1)](#c:init/1)

[validate(arg1, arg2)](#c:validate/2)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:path/0 "Link to this type")

path()

======

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L45 "View Source")

Specs

-----

```

path() :: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]

```

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L44 "View Source")

Specs

-----

```

t() :: %Ash.Resource.Validation{

  expensive?: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  module: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  on: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  opts: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(),

  validation: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#on/1 "Link to this function")

on(list)

========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L78 "View Source")

[Link to this function](#opt_schema/0 "Link to this function")

opt\_schema()

=============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L76 "View Source")

[Link to this function](#transform/1 "Link to this function")

transform(validation)

=====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L72 "View Source")

[Link to this function](#validation/1 "Link to this function")

validation(module)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L91 "View Source")

[Link to this section](#callbacks)

Callbacks

=============================================

[Link to this callback](#c:init/1 "Link to this callback")

init(arg1)

==========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L46 "View Source")

Specs

-----

```

init([Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()} | {:error, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()}

```

[Link to this callback](#c:validate/2 "Link to this callback")

validate(arg1, arg2)

====================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L47 "View Source")

Specs

-----

```

validate([Ash.changeset](Ash.html#t:changeset/0)(), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: :ok | {:error, [Ash.error](Ash.html#t:error/0)()}

```





Ash.Resource.Validation.Builtins — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Validation.Builtins [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation/builtins.ex#L1 "View Source")

=====================================================================================================================================================================

Built in validations that are available to all resources

The functions in this module are imported by default in the validations section.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[absent(attributes, opts \\ [])](#absent/2)

[present(attributes, opts \\ [])](#present/2)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#absent/2 "Link to this function")

absent(attributes, opts \\ [])

==============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation/builtins.ex#L20 "View Source")

[Link to this function](#present/2 "Link to this function")

present(attributes, opts \\ [])

===============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation/builtins.ex#L10 "View Source")





Ash.Resource.Validation.Present — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Resource.Validation.Present [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation/present.ex#L1 "View Source")

===================================================================================================================================================================

Validates that the provided attribute is non-nil

 





Ash.Type — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Type behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L1 "View Source")

====================================================================================================================================

This behaviour is a superset of the Ecto.Type behavior, that also contains

api level information, like what kinds of filters are allowed. Eventually,

this may be used for composite types or serialization.

Much better to `use Ash.Type` than to say `@behaviour Ash.Type` and define

everything yourself.

 Built in types

-----------------

* `:term` - [`Ash.Type.Term`](Ash.Type.Term.html)

* `:string` - [`Ash.Type.String`](Ash.Type.String.html)

* `:integer` - [`Ash.Type.Integer`](Ash.Type.Integer.html)

* `:boolean` - [`Ash.Type.Boolean`](Ash.Type.Boolean.html)

* `:uuid` - [`Ash.Type.UUID`](Ash.Type.UUID.html)

* `:date` - [`Ash.Type.Date`](Ash.Type.Date.html)

* `:utc_datetime` - [`Ash.Type.UtcDatetime`](Ash.Type.UtcDatetime.html)

### 

 Composite Types

Currently, the only composite type supported is a list type, specified via:

`{:array, Type}`. The constraints available are:

* `:items` - Constraints for the elements of the list. See the contained type's docs for more.

* `:min_length` - A minimum length for the items

* `:max_length` - A maximum length for the items

* `:nil_items?` - Whether or not the list can contain nil items The default value is `true`.

 

[Link to this section](#summary)

 Summary

==========================================

[Types](#types)

----------------

[constraints()](#t:constraints/0)

[t()](#t:t/0)

[Functions](#functions)

------------------------

[apply\_constraints(type, term, constraints)](#apply_constraints/3)

Confirms if a casted value matches the provided constraints.

[ash\_type?(module)](#ash_type?/1)

Returns true if the value is a builtin type or adopts the [`Ash.Type`](#content) behaviour

[cast\_input(type, term)](#cast_input/2)

Casts input (e.g. unknown) data to an instance of the type, or errors

[cast\_stored(type, term)](#cast_stored/2)

Casts a value from the data store to an instance of the type, or errors

[constraints(type)](#constraints/1)

[dump\_to\_native(type, term)](#dump_to_native/2)

Casts a value from the Elixir type to a value that the data store can persist

[ecto\_type(type)](#ecto_type/1)

Returns the ecto compatible type for an Ash.Type.

[equal?(type, left, right)](#equal?/3)

Determines if two values of a given type are equal.

[get\_type(value)](#get_type/1)

[storage\_type(type)](#storage_type/1)

Returns the *underlying* storage type (the underlying type of the *ecto type* of the *ash type*)

[Callbacks](#callbacks)

------------------------

[apply\_constraints(term, constraints)](#c:apply_constraints/2)

[cast\_input(term)](#c:cast_input/1)

[cast\_stored(term)](#c:cast_stored/1)

[constraints()](#c:constraints/0)

[dump\_to\_native(term)](#c:dump_to_native/1)

[ecto\_type()](#c:ecto_type/0)

[equal?(term, term)](#c:equal?/2)

[storage\_type()](#c:storage_type/0)

[Link to this section](#types)

Types

=====================================

[Link to this type](#t:constraints/0 "Link to this type")

constraints()

=============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L56 "View Source")

Specs

-----

```

constraints() :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()

```

[Link to this type](#t:t/0 "Link to this type")

t()

===

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L66 "View Source")

Specs

-----

```

t() :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | {:array, [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()}

```

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#apply_constraints/3 "Link to this function")

apply\_constraints(type, term, constraints)

===========================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L197 "View Source")

Specs

-----

```

apply_constraints([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [constraints](#t:constraints/0)()) :: :ok | {:error, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()}

```

Confirms if a casted value matches the provided constraints.

 

[Link to this function](#ash_type?/1 "Link to this function")

ash\_type?(module)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L113 "View Source")

Specs

-----

```

ash_type?([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Returns true if the value is a builtin type or adopts the [`Ash.Type`](#content) behaviour

 

[Link to this function](#cast_input/2 "Link to this function")

cast\_input(type, term)

=======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L130 "View Source")

Specs

-----

```

cast_input([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()} | :error

```

Casts input (e.g. unknown) data to an instance of the type, or errors

Maps to [`Ecto.Type.cast/2`](https://hexdocs.pm/ecto/Ecto.Type.html#cast/2)

 

[Link to this function](#cast_stored/2 "Link to this function")

cast\_stored(type, term)

========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L171 "View Source")

Specs

-----

```

cast_stored([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :error

```

Casts a value from the data store to an instance of the type, or errors

Maps to [`Ecto.Type.load/2`](https://hexdocs.pm/ecto/Ecto.Type.html#load/2)

 

[Link to this function](#constraints/1 "Link to this function")

constraints(type)

=================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L283 "View Source")

Specs

-----

```

constraints([t](#t:t/0)()) :: [constraints](#t:constraints/0)()

```

[Link to this function](#dump_to_native/2 "Link to this function")

dump\_to\_native(type, term)

============================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L297 "View Source")

Specs

-----

```

dump_to_native([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :error

```

Casts a value from the Elixir type to a value that the data store can persist

Maps to [`Ecto.Type.dump/2`](https://hexdocs.pm/ecto/Ecto.Type.html#dump/2)

 

[Link to this function](#ecto_type/1 "Link to this function")

ecto\_type(type)

================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L101 "View Source")

Specs

-----

```

ecto_type([t](#t:t/0)()) :: [Ecto.Type.t](https://hexdocs.pm/ecto/Ecto.Type.html#t:t/0)()

```

Returns the ecto compatible type for an Ash.Type.

If you `use Ash.Type`, this is created for you. For builtin types

this may return a corresponding ecto builtin type (atom)

 

[Link to this function](#equal?/3 "Link to this function")

equal?(type, left, right)

=========================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L321 "View Source")

Specs

-----

```

equal?([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

Determines if two values of a given type are equal.

Maps to [`Ecto.Type.equal?/3`](https://hexdocs.pm/ecto/Ecto.Type.html#equal?/3)

 

[Link to this function](#get_type/1 "Link to this function")

get\_type(value)

================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L72 "View Source")

Specs

-----

```

get_type([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this function](#storage_type/1 "Link to this function")

storage\_type(type)

===================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L91 "View Source")

Specs

-----

```

storage_type([t](#t:t/0)()) :: [Ecto.Type.t](https://hexdocs.pm/ecto/Ecto.Type.html#t:t/0)()

```

Returns the *underlying* storage type (the underlying type of the *ecto type* of the *ash type*)

 

[Link to this section](#callbacks)

Callbacks

=============================================

[Link to this callback](#c:apply_constraints/2 "Link to this callback")

apply\_constraints(term, constraints)

=====================================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L63 "View Source")

Specs

-----

```

apply_constraints([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [constraints](#t:constraints/0)()) ::

  :ok | {:error, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()]}

```

[Link to this callback](#c:cast_input/1 "Link to this callback")

cast\_input(term)

=================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L59 "View Source")

Specs

-----

```

cast_input([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()} | :error

```

[Link to this callback](#c:cast_stored/1 "Link to this callback")

cast\_stored(term)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L60 "View Source")

Specs

-----

```

cast_stored([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :error

```

[Link to this callback](#c:constraints/0 "Link to this callback")

constraints()

=============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L62 "View Source")

Specs

-----

```

constraints() :: [constraints](#t:constraints/0)()

```

[Link to this callback](#c:dump_to_native/1 "Link to this callback")

dump\_to\_native(term)

======================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L61 "View Source")

Specs

-----

```

dump_to_native([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :error

```

[Link to this callback](#c:ecto_type/0 "Link to this callback")

ecto\_type()

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L58 "View Source")

Specs

-----

```

ecto_type() :: [Ecto.Type.t](https://hexdocs.pm/ecto/Ecto.Type.html#t:t/0)()

```

[Link to this callback](#c:equal?/2 "Link to this callback")

equal?(term, term)

==================

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L64 "View Source")

Specs

-----

```

equal?([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()

```

[Link to this callback](#c:storage_type/0 "Link to this callback")

storage\_type()

===============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L57 "View Source")

Specs

-----

```

storage_type() :: [Ecto.Type.t](https://hexdocs.pm/ecto/Ecto.Type.html#t:t/0)()

```





Ash.Type.Boolean — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Type.Boolean [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/boolean.ex#L1 "View Source")

=====================================================================================================================================

Represents a boolean.

A builtin type that can be referenced via `:boolean`

 





Ash.Type.Date — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Type.Date [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/date.ex#L1 "View Source")

===============================================================================================================================

Represents a date in the database

A builtin type that can be referenced via `:date`

 





Ash.Type.Integer — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Type.Integer [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/integer.ex#L1 "View Source")

=====================================================================================================================================

Represents a simple integer

A builtin type that can be referenced via `:integer`

### 

 Constraints

* `:max` - Enforces a maximum on the value

* `:min` - Enforces a minimum on the value

 





Ash.Type.String — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Type.String [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/string.ex#L1 "View Source")

===================================================================================================================================

Stores a string in the database

A builtin type that can be referenced via `:string`

### 

 Constraints

* `:max_length` - Enforces a maximum length on the value

* `:min_length` - Enforces a minimum length on the value

* `:match` - Enforces that the string matches a passed in regex

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[match(regex)](#match/1)

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#match/1 "Link to this function")

match(regex)

============

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/string.ex#L82 "View Source")





Ash.Type.Term — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Type.Term [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/term.ex#L1 "View Source")

===============================================================================================================================

Represents a raw elixir term in the database

A builtin type that can be referenced via `:string`

 





Ash.Type.UUID — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Type.UUID [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/uuid.ex#L1 "View Source")

===============================================================================================================================

Represents a UUID.

A builtin type that can be referenced via `:utc_datetime`

 





Ash.Type.UtcDatetime — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

Ash.Type.UtcDatetime [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/utc_datetime.ex#L1 "View Source")

==============================================================================================================================================

Represents a utc datetime

A builtin type that can be referenced via `:utc_datetime`

 





mix ash.formatter — ash v0.11.0

try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }

ash v0.11.0

mix ash.formatter [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/mix/tasks/ash.formatter.ex#L1 "View Source")

=============================================================================================================================================

Generates a .formatter.exs from a list of extensions, and writes it.

 

[Link to this section](#summary)

 Summary

==========================================

[Functions](#functions)

------------------------

[run(opts)](#run/1)

Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1).

[Link to this section](#functions)

Functions

=============================================

[Link to this function](#run/1 "Link to this function")

run(opts)

=========

[View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/mix/tasks/ash.formatter.ex#L21 "View Source")

Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1).

 

