Search documentation of ash

# API Reference ash v3.4.71

View Source

## Modules

Ash

The primary interface to call actions and interact with resources.

Ash.ActionInput

Input for a custom action

Ash.Actions.Read.AsyncLimiter

A utility for limiting the number of concurrent async operations

Ash.Authorizer

The interface for an ash authorizer

Ash.BulkResult

The return value for bulk actions.

Ash.Can

Contains the Ash.can function logic.

Ash.Changeset

Changesets are used to create and update data in Ash.

Ash.Changeset.ManagedRelationshipHelpers

Tools for introspecting managed relationships.

Ash.Changeset.OriginalDataNotAvailable

A value placed in changeset.data to indicate that the original data is not available

Ash.CiString

Represents a case insensitive string

Ash.CodeInterface

Used to define the functions of a code interface for a resource.

Ash.Context

Functions for working with the context provided to various callbacks in Ash.

Ash.CustomExpression

A module for defining custom functions that can be called in Ash expressions.

Ash.DataLayer

The behaviour for backing resource actions with persistence layers.

Ash.DataLayer.Ets

An ETS (Erlang Term Storage) backed Ash Datalayer, for testing and lightweight usage.

Ash.DataLayer.Ets.Info

Introspection helpers for the Ets data layer

Ash.DataLayer.Mnesia

An Mnesia backed Ash Datalayer.

Ash.DataLayer.Mnesia.Info

Introspection helpers for Ash.DataLayer.Mnesia

Ash.DataLayer.Simple

A data layer that returns structs.

Ash.DataLayer.Verifiers.RequirePreCheckWith

Ensures that all identities have a `pre_check_with` configured, or raises.

Ash.Domain

A domain allows you to interact with your resources, and holds domain-wide configuration.

Ash.Domain.Dsl.ResourceReference

A resource reference in a domain

Ash.Domain.Igniter

Codemods for working with Ash.Domain modules

Ash.Domain.Info

Introspection tools for Ash.Domain

Ash.Domain.Info.Diagram

Generate Mermaid diagrams from a specified domain.

Ash.Domain.Info.Livebook

Generate a Livebook from a specified domain.

Ash.Domain.Verifiers.EnsureNoEmbeds

Ensures that all resources for a given domain are not embeds.

Ash.Domain.Verifiers.ValidateArgumentsToCodeInterface

Validate the arguments defined in the code interface and reject arguments that are not action attributes/arguments

Ash.Domain.Verifiers.ValidateRelatedResourceInclusion

Ensures that all related resources are included in a domain.

Ash.Error

Tools and utilities used by Ash to manage and conform errors

Ash.Error.Action.InvalidArgument

Used when an invalid value is provided for an action argument

Ash.Error.Changes.ActionRequiresActor

Used when an actor is referenced in a filter template, but no actor exists

Ash.Error.Changes.InvalidArgument

Used when an invalid value is provided for an action argument

Ash.Error.Changes.InvalidAttribute

Used when an invalid value is provided for an attribute change

Ash.Error.Changes.InvalidChanges

Used when a change is provided that covers multiple attributes/relationships

Ash.Error.Changes.InvalidRelationship

Used when an invalid value is provided for a relationship change

Ash.Error.Changes.NoSuchAttribute

Used when a change is provided for an attribute that does not exist

Ash.Error.Changes.NoSuchRelationship

Used when a change is provided for an relationship that does not exist

Ash.Error.Changes.Required

Used when an attribute or relationship is required

Ash.Error.Changes.StaleRecord

Used when a stale record is attempted to be updated or deleted

Ash.Error.Exception

Tooling for creating an Ash exception

Ash.Error.Forbidden

Used when authorization for an action fails

Ash.Error.Forbidden.CannotFilterCreates

Used when a create action would be filtered

Ash.Error.Forbidden.DomainRequiresActor

Used when a domain that has `require_actor? true` is provided no actor

Ash.Error.Forbidden.DomainRequiresAuthorization

Used when a domain that has `authorize :always` is provided authorize?: false

Ash.Error.Forbidden.ForbiddenField

Raised in cases where access to a specific field was prevented

Ash.Error.Forbidden.InitialDataRequired

Used when initial data was not supplied when it was required

Ash.Error.Forbidden.MustPassStrictCheck

Used when unreachable code/conditions are reached in the framework

Ash.Error.Forbidden.Placeholder

A placeholder exception that the user should never see

Ash.Error.Forbidden.Policy

Raised when policy authorization for an action fails

Ash.Error.Framework

Used when an unknown/generic framework error occurs

Ash.Error.Framework.AssumptionFailed

Used when unreachable code/conditions are reached in the framework

Ash.Error.Framework.CanNotBeAtomic

Used when a change that is only atomic cannot be done atomically

Ash.Error.Framework.FlagAssertionFailed

Used when unreachable code/conditions are reached in the framework

Ash.Error.Framework.InvalidReturnType

Used when a callback returns an invalid type

Ash.Error.Framework.MustBeAtomic

Used when an action that must be atomic cannot be done atomically

Ash.Error.Framework.SynchronousEngineStuck

Used when the sycnrhonous engine cannot proceed

Ash.Error.Invalid

The top level invalid error

Ash.Error.Invalid.ActionRequiresPagination

Used when page option is passed but pagination is not enabled.

Ash.Error.Invalid.AtomicsNotSupported

Used when atomics for the given action type are not not supported by the data layer, but one is used.

Ash.Error.Invalid.InvalidActionType

Used when a callback returns an invalid type

Ash.Error.Invalid.InvalidPrimaryKey

Used when an invalid primary key is given to `Ash.get/2`

Ash.Error.Invalid.LimitRequired

Used when no limit is provided, pagination is required, and no default page size is configured

Ash.Error.Invalid.MultipleResults

Used when multiple results are returned in a case where only one result was expected

Ash.Error.Invalid.NoIdentityFound

Used when an identity name is used that does not reference identity on the resource

Ash.Error.Invalid.NoMatchingBulkStrategy

Used when an identity name is used that does not reference identity on the resource

Ash.Error.Invalid.NoPrimaryAction

Used when an action name is provided that doesn't exist

Ash.Error.Invalid.NoSuchAction

Used when an action name is provided that doesn't exist

Ash.Error.Invalid.NoSuchInput

Used when an input is provided to an action or calculation that is not accepted

Ash.Error.Invalid.NoSuchResource

Used when a resource or alias is provided that doesn't exist

Ash.Error.Invalid.NonCountableAction

Used when page[:count] option is passed but the action's pagination is not countable.

Ash.Error.Invalid.NonStreamableAction

Used when Ash.stream is used with an action that does not support keyset pagination

Ash.Error.Invalid.PaginationRequired

Used when `page: false` is provided but pagination is required

Ash.Error.Invalid.ResourceNotAllowed

Used when a resource or alias is provided that cannot be used with the given domain

Ash.Error.Invalid.TenantRequired

Used when a tenant is not specified

Ash.Error.Invalid.Timeout

Used when a request to a domain times out.

Ash.Error.Invalid.TimeoutNotSupported

Used when timeouts are not supported by the data layer, but one is set

Ash.Error.Invalid.Unavailable

Used when a given resource is unavailable.

Ash.Error.Load.InvalidQuery

Used when an invalid query is provided in a load

Ash.Error.Load.NoSuchRelationship

Used when attempting to load a relationship that does not exist

Ash.Error.Page.InvalidKeyset

Used when a value is provided for a keyset that cannot be Base64 decoded.

Ash.Error.Query.AggregatesNotSupported

Used when the data_layer does not support aggregates, or filtering/sorting them

Ash.Error.Query.CalculationRequiresPrimaryKey

Used when a calculation requires a primary key but was not supplied with one

Ash.Error.Query.CalculationsNotSupported

Used when the data_layer does not support calculations, or filtering/sorting them

Ash.Error.Query.InvalidArgument

Used when an invalid value is provided for an action argument

Ash.Error.Query.InvalidCalculationArgument

Used when an invalid value is provided for a calculation argument

Ash.Error.Query.InvalidExpression

Used when an invalid expression is used in a filter

Ash.Error.Query.InvalidFilterReference

Used when an invalid reference is used in a filter

Ash.Error.Query.InvalidFilterValue

Used when an invalid value is provided for a filter

Ash.Error.Query.InvalidLimit

Used when an invalid limit is provided

Ash.Error.Query.InvalidLoad

Used when an invalid load is provided

Ash.Error.Query.InvalidOffset

Used when an invalid offset is provided

Ash.Error.Query.InvalidPage

Used when an invalid page option is provided

Ash.Error.Query.InvalidQuery

A generic error that can be used to add an error to a query for a specific field

Ash.Error.Query.InvalidSortOrder

Used when an invalid sort order is provided

Ash.Error.Query.LockNotSupported

Used when the data_layer does not support a given lock type

Ash.Error.Query.NoComplexSortsWithKeysetPagination

Due to the filter-based implementation of keyset pagination, it cannot be used with sorts on calculations.

Ash.Error.Query.NoReadAction

Used when a resource would be read but has no read action

Ash.Error.Query.NoSuchAttribute

Used when an attribute that doesn't exist is used in a query

Ash.Error.Query.NoSuchField

Used when a field(attrbute, calculation, aggregate or relationship) that doesn't exist is used in a query

Ash.Error.Query.NoSuchFilterPredicate

Used when a filter predicate that does not exist is referenced

Ash.Error.Query.NoSuchFunction

Used when an function that doesn't exist is used in a query

Ash.Error.Query.NoSuchOperator

Used when an operator that doesn't exist is used in a query

Ash.Error.Query.NoSuchRelationship

Used when an relationship that doesn't exist is used in a query

Ash.Error.Query.NotFound

Used when an entity that not exist is referenced

Ash.Error.Query.ReadActionRequired

Used when a relationship is filtered and the destination does not have a default read action

Ash.Error.Query.ReadActionRequiresActor

Used when an actor is referenced in a filter template, but no actor exists

Ash.Error.Query.Required

Used when a filter or argument is required in a query

Ash.Error.Query.UnsortableField

Used when attempting to sort on a field that cannot be used for sorting

Ash.Error.Query.UnsupportedPredicate

Used when the data_layer does not support a provided predicate

Ash.Error.SimpleDataLayer.NoDataProvided

Used when no data was provided to the simple data layer

Ash.Error.Stacktrace

A placeholder for a stacktrace so that we can avoid printing it everywhere

Ash.Error.Unknown

The top level unknown error container

Ash.Error.Unknown.UnknownError

Used when an unknown error occurs

Ash.Expr

Tools to build Ash expressions

Ash.Extension

A behavior of additional callbacks that extensions can implement, specific to Ash.

Ash.Filter

The representation of a filter in Ash.

Ash.Filter.Predicate

Represents a predicate which can be simplified and/or compared with other predicates

Ash.Filter.Runtime

Checks a record to see if it matches a filter statement.

Ash.Filter.Simple

Represents a simplified filter, with a simple list of predicates

Ash.Filter.Simple.Not

A negated predicate

Ash.ForbiddenField

Represents a field that was hidden due to authorization rules.

Ash.Generator

Tools for generating input to Ash resource actions and for generating seed data.

Ash.Igniter

Codemods and utilities for working with Ash & Igniter

Ash.Mix.Tasks.Helpers

Helpers for Ash Mix tasks.

Ash.NotLoaded

Used when a field hasn't been loaded or selected.

Ash.Notifier

A notifier is an extension that receives various events

Ash.Notifier.Notification

Represents a notification that will be handled by a resource's notifiers

Ash.Notifier.PubSub

A builtin notifier to help you publish events over any kind of pub-sub tooling.

Ash.Notifier.PubSub.Info

Introspection helpers for Ash.Notifier.PubSub

Ash.Notifier.PubSub.Publication

Represents a configured publication from the pubsub notifier on an Ash.Resource

Ash.Notifier.PubSub.Verifiers.VerifyActionNames

Verifies action names in configured publications

Ash.OptionsHelpers

Helpers for working with nimble options

Ash.Page

Types for Ash pages

Ash.Page.Keyset

A page of results from `keyset` based pagination.

Ash.Page.Offset

A page of results from `offset` based pagination.

Ash.PlugHelpers

Helpers for working with the Plug connection.

Ash.Policy.Authorizer

An authorization extension for ash resources.

Ash.Policy.Authorizer.Transformers.AddMissingFieldPolicies

Adds field policies for any missing fields

Ash.Policy.Authorizer.Transformers.CacheFieldPolicies

Cache field policies for each field

Ash.Policy.Chart.Mermaid

Generates policy mermaid charts

Ash.Policy.Check

A behaviour for declaring checks, which can be used to easily construct authorization rules.

Ash.Policy.Check.AccessingFrom

This check is true when the current action is being run "through" a relationship.

Ash.Policy.Check.Action

This check is true when the action name matches the provided action name.

Ash.Policy.Check.ActionType

This check is true when the action type matches the provided type

Ash.Policy.Check.ActorAbsent

This check is true when the actor is `nil`, and false when the actor is specified.

Ash.Policy.Check.ActorAttributeEquals

This check is true when the value of the specified attribute of the actor equals the specified value.

Ash.Policy.Check.ActorPresent

This check is true when there is an actor specified, and false when the actor is `nil`.

Ash.Policy.Check.Builtins

The global authorization checks built into ash

Ash.Policy.Check.ChangingAttributes

This check is true when attribute changes correspond to the provided options.

Ash.Policy.Check.ChangingRelationships

This check is true when the specified relationship is changing

Ash.Policy.Check.ContextEquals

This check is true when the value of the specified key or path in the changeset or query context equals the specified value.

Ash.Policy.Check.Expression

The check module used for `expr`s in policies

Ash.Policy.Check.FilteringOn

This check is true when the field provided is being referenced anywhere in a filter statement.

Ash.Policy.Check.Loading

This check is true when the field or relationship, or path to field, is being loaded and false when it is not.

Ash.Policy.Check.Matches

This check is true when the specified function returns true

Ash.Policy.Check.RelatesToActorVia

This check passes if the data relates to the actor via the specified relationship or path of relationships.

Ash.Policy.Check.RelatingToActor

This check is true when the specified relationship is being changed to the current actor.

Ash.Policy.Check.Resource

This check is true when the resource matches the provided resource name or names.

Ash.Policy.Check.Selecting

This check is true when the field is being selected and false when it is not.

Ash.Policy.Check.Static

This check is always the result provided

Ash.Policy.FieldPolicy

Represents a field policy in an Ash.Resource

Ash.Policy.FilterCheck

A type of check that is represented by a filter statement

Ash.Policy.Info

An authorization extension for ash resources.

Ash.Policy.Policy

Represents a policy on an Ash.Resource

Ash.Policy.PolicyGroup

Represents a policy group on an Ash.Resource

Ash.Policy.SimpleCheck

A type of check that operates only on request context, never on the data

Ash.ProcessHelpers

Helpers for working with processes and Ash actions.

Ash.Query

A data structure for reading data from a resource.

Ash.Query.Aggregate

Represents an aggregated association value

Ash.Query.BooleanExpression

Represents a boolean expression

Ash.Query.Calculation

Represents a calculated attribute requested on a query

Ash.Query.Call

Represents a function call/AST node in an Ash query expression

Ash.Query.Exists

Determines if a given related entity exists.

Ash.Query.Function

A function is a predicate with an arguments list.

Ash.Query.Function.Ago

Subtracts the given interval from the current time in UTC.

Ash.Query.Function.At

Gets an element in the list by index

Ash.Query.Function.CompositeType

Constructs a composite type in a way that is natively understood by the data layer

Ash.Query.Function.Contains

Returns true if the first string contains the second.

Ash.Query.Function.CountNils

Returns the count of nil.

Ash.Query.Function.DateAdd

Adds the given interval to the current time in UTC

Ash.Query.Function.DateTimeAdd

Adds the given interval to the current time in UTC

Ash.Query.Function.Error

If the predicate is truthy, the provided exception is raised with the provided values.

Ash.Query.Function.Fragment

Adds the given interval from the current time in UTC.

Ash.Query.Function.FromNow

Adds the given interval from the current time in UTC.

Ash.Query.Function.GetPath

Gets the value at the provided path in the value, which must be a map or embed.

Ash.Query.Function.If

If predicate is truthy, then the second argument is returned, otherwise the third.

Ash.Query.Function.IsNil

true if the provided field is nil

Ash.Query.Function.Lazy

Runs the provided MFA and returns the result as a known value.

Ash.Query.Function.Length

Returns the length of a list attribute defined by the composite type `{:array, Type}`.

Ash.Query.Function.Minus

Multiplies the value by negative one

Ash.Query.Function.Now

Returns the current datetime

Ash.Query.Function.Round

Rounds a float, decimal or integer to the given number of points

Ash.Query.Function.StartOfDay

Converts a date or datetime into the start of day

Ash.Query.Function.StringDowncase

Downcase a string

Ash.Query.Function.StringJoin

Joins a list of values.

Ash.Query.Function.StringLength

Trims whitespace from a string

Ash.Query.Function.StringPosition

Returns the zero-based position of a substring within a string, nil if the string does not contain the substring.

Ash.Query.Function.StringSplit

Split a string into a list of strings

Ash.Query.Function.StringTrim

Trims whitespace from a string

Ash.Query.Function.Today

Returns the current date.

Ash.Query.Function.Type

Casts the value to a given type. Can also be used to provide type hints to data layers, where appropriate.

Ash.Query.Not

Represents the negation of the contained expression

Ash.Query.Operator

An operator is a predicate with a `left` and a `right`

Ash.Query.Operator.Eq

left == right

Ash.Query.Operator.GreaterThan

left > right

Ash.Query.Operator.GreaterThanOrEqual

left >= right

Ash.Query.Operator.In

left in [1, 2, 3]

Ash.Query.Operator.IsNil

left is_nil true/false

Ash.Query.Operator.LessThan

left < right

Ash.Query.Operator.LessThanOrEqual

left <= right

Ash.Query.Operator.NotEq

left != right

Ash.Query.Parent

Used to access values from the "source" of a given expression.

Ash.Query.Ref

Represents a relation/attribute reference

Ash.Query.UpsertConflict

Returns the conflicting new information.

Ash.Reactor

`Ash.Reactor` is a `Reactor` extension which provides steps for working with Ash resources and actions.

Ash.Reactor.ActionStep

The Reactor step which is used to execute generic actions.

Ash.Reactor.AshStep

A reactor step which runs a step-module or an anonymous function, and enqueues any returned notifications before returning.

Ash.Reactor.BulkCreateStep

The Reactor stop which is used to execute create actions in bulk.

Ash.Reactor.BulkUpdateStep

The Reactor stop which is used to execute create actions in bulk.

Ash.Reactor.ChangeStep

The Reactor step which is used to execute change steps.

Ash.Reactor.CreateStep

The Reactor step which is used to execute create actions.

Ash.Reactor.DestroyStep

The Reactor step which is used to execute update actions.

Ash.Reactor.Dsl.Action

The `action` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.ActionLoad

Add a load statement to an action.

Ash.Reactor.Dsl.ActionTransformer

Responsible for transforming actions.

Ash.Reactor.Dsl.Actor

Specify the actor used to execute an action.

Ash.Reactor.Dsl.AshStep

The ash_step DSL module.

Ash.Reactor.Dsl.BulkCreate

The `bulk_create` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.BulkUpdate

The `bulk_update` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.Change

The `change` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.Context

Specify context to merge into an action's context.

Ash.Reactor.Dsl.Create

The `create` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.Destroy

The `destroy` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.Inputs

The `inputs` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.Load

The `load` step entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.MiddlewareTransformer

Ensures that the required middlewares are added to the Reactor.

Ash.Reactor.Dsl.Read

The `read` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.ReadOne

The `read_one` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.Tenant

Specify the tenant used to execute an action.

Ash.Reactor.Dsl.Transaction

The `transaction` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.Dsl.Update

The `update` entity for the `Ash.Reactor` reactor extension.

Ash.Reactor.LoadStep

The Reactor step which is used to execute load steps.

Ash.Reactor.MergeInputsStep

A custom step which merges any number of `inputs` results into a single map.

Ash.Reactor.Notifications

Reactor middleware used to collect and emit notifications upon successful completion of the Reactor.

Ash.Reactor.ReadOneStep

The Reactor step which is used to execute get actions.

Ash.Reactor.ReadStep

The Reactor step which is used to execute read actions.

Ash.Reactor.Tracer

Reactor middleware which threads Ash's tracing information through to new processes spawned by Reactor.

Ash.Reactor.TransactionStep

The Reactor step which is used to wrap other steps in an Ash data layer transaction.

Ash.Reactor.UpdateStep

The Reactor step which is used to execute update actions.

Ash.Resource

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

Ash.Resource.Actions

Types for Ash actions

Ash.Resource.Actions.Action

Represents a custom action on a resource.

Ash.Resource.Actions.Argument

Represents an argument to an action

Ash.Resource.Actions.Create

Represents a create action on a resource.

Ash.Resource.Actions.Destroy

Represents a destroy action on a resource.

Ash.Resource.Actions.Implementation

An implementation of a generic action.

Ash.Resource.Actions.Implementation.Context

The context passed into generic action functions

Ash.Resource.Actions.Metadata

Represents metadata from an action

Ash.Resource.Actions.Read

Represents a read action on a resource.

Ash.Resource.Actions.Read.Pagination

Represents the pagination configuration of a read action

Ash.Resource.Actions.Update

Represents a update action on a resource.

Ash.Resource.Aggregate

Represents a named aggregate on the resource that can be loaded

Ash.Resource.Aggregate.CustomAggregate

The root behavior for a custom aggregate.

Ash.Resource.Aggregate.JoinFilter

Represents a join filter on a resource aggregate

Ash.Resource.Attribute

Represents an attribute on a resource

Ash.Resource.Attribute.Helpers

Helpers for building attributes

Ash.Resource.Builder

Tools for transforming resources in DSL Transformers.

Ash.Resource.Calculation

The behaviour for defining a module calculation, and the struct for storing a defined calculation.

Ash.Resource.Calculation.Argument

An argument to a calculation

Ash.Resource.Calculation.Builtins

Built in calculations that are automatically imported in the calculations section

Ash.Resource.Calculation.Context

The context and arguments of a calculation

Ash.Resource.Calculation.LoadAttribute

Loads an attribute as a calculation.

Ash.Resource.Calculation.LoadRelationship

Loads a relationship as a calculation.

Ash.Resource.CalculationInterface

Represents a function that evaluates a calculation in a resource's code interface

Ash.Resource.Change

The behaviour for an action-specific resource change.

Ash.Resource.Change.Builtins

Built in changes that are available to all resources

Ash.Resource.Change.CascadeDestroy

Cascade a resource's destroy action to a related resource's destroy action.

Ash.Resource.Change.CascadeUpdate

Cascade a resource's update action to a related resource's update action.

Ash.Resource.Change.Context

The context for a change.

Ash.Resource.Change.GetAndLock

Refetches the record being updated or destroyed, and locks it with the given type.

Ash.Resource.Change.GetAndLockForUpdate

Refetches the record being updated or destroyed, and locks it for update.

Ash.Resource.Change.Increment

Increments an attribute's value by the amount specified, which defaults to 1.

Ash.Resource.Change.OptimisticLock

Apply an "optimistic lock" on a record being updated or destroyed.

Ash.Resource.Dsl.Filter

Introspection target for a filter for read actions and relationships

Ash.Resource.Identity

Represents a unique constraint on a resource

Ash.Resource.Igniter

Codemods for working with Ash.Resource modules

Ash.Resource.Info

Introspection for resources

Ash.Resource.Interface

Represents a function in a resource's code interface

Ash.Resource.ManualCreate

A module to implement manual create actions.

Ash.Resource.ManualCreate.Context

The context passed into manual update action functions

Ash.Resource.ManualDestroy

A module to implement manual destroy actions.

Ash.Resource.ManualDestroy.Context

The context passed into manual update action functions

Ash.Resource.ManualRead

A module to implement manual read actions.

Ash.Resource.ManualRelationship

A module to implement manual relationships.

Ash.Resource.ManualRelationship.Context

The context passed into manual relationship functions

Ash.Resource.ManualUpdate

A module to implement manual update actions.

Ash.Resource.ManualUpdate.Context

The context passed into manual update action functions

Ash.Resource.Preparation

The behaviour for an action-specific query preparation.

Ash.Resource.Preparation.Builtins

Builtin query preparations

Ash.Resource.Preparation.Context

The context for a preparation.

Ash.Resource.Relationships

Types Ash relationships

Ash.Resource.Relationships.BelongsTo

Represents a belongs_to relationship on a resource

Ash.Resource.Relationships.HasMany

Represents a has_many relationship on a resource

Ash.Resource.Relationships.HasOne

Represents a has_one relationship on a resource

Ash.Resource.Relationships.ManyToMany

Represents a many_to_many relationship on a resource

Ash.Resource.Transformers.AttributesByName

Persists attribute_names and attributes_by_name.

Ash.Resource.Transformers.BelongsToAttribute

Creates the attribute for belongs_to relationships that have `define_attribute?: true`

Ash.Resource.Transformers.CacheActionInputs

Stores the set of valid input keys for each action

Ash.Resource.Transformers.CacheCalculations

Persists commonly used calculation information.

Ash.Resource.Transformers.CachePrimaryKey

Validates and caches the primary key of a resource

Ash.Resource.Transformers.CacheRelationships

Persists commonly used relationship information.

Ash.Resource.Transformers.CacheUniqueKeys

Stores the set of unique keys for a resource

Ash.Resource.Transformers.CreateJoinRelationship

Creates an automatically named `has_many` relationship for each many_to_many.

Ash.Resource.Transformers.DefaultAccept

Sets the default `accept` for each action

Ash.Resource.Transformers.GetByReadActions

Transform any read actions which contain a `get_by` option.

Ash.Resource.Transformers.HasDestinationField

Guesses the `destination_attribute` for has many and has one relationships unless provided

Ash.Resource.Transformers.ManyToManyDestinationAttributeOnJoinResource

Guesses the `destination_attribute_on_join_resource` for many to many relationships unless provided.

Ash.Resource.Transformers.ManyToManySourceAttributeOnJoinResource

Guesses the `source_attribute_on_join_resource` for many to many relationships unless provided.

Ash.Resource.Transformers.RequireUniqueActionNames

Ensures that all actions have unique names.

Ash.Resource.Transformers.RequireUniqueFieldNames

Confirms that a resource does not have multiple fields(attributes, calculations, aggregates, and relationships) with the same name.

Ash.Resource.Transformers.SetPrimaryActions

Validates the primary action configuration

Ash.Resource.Transformers.SetRelationshipSource

Sets the `source` key on relationships to be the resource they were defined on

Ash.Resource.Transformers.ValidationsAndChangesForType

Persists global changes/validations and what type they go on.

Ash.Resource.Validation

Represents a validation in Ash.

Ash.Resource.Validation.ActionIs

Validates that the action is the specified action.

Ash.Resource.Validation.Builtins

Built in validations that are available to all resources

Ash.Resource.Validation.Context

Context for a validation.

Ash.Resource.Verifiers.EnsureAggregateFieldIsAttributeOrCalculation

Ensures that the field at the end of the path is an attribute or calculation.

Ash.Resource.Verifiers.NoReservedFieldNames

Confirms that a resource does not use reserved names for field names.

Ash.Resource.Verifiers.ValidateAccept

Validates that accept and reject lists only contain valid attributes

Ash.Resource.Verifiers.ValidateActionTypesSupported

Confirms that all action types declared on a resource are supported by its data layer

Ash.Resource.Verifiers.ValidateAggregatesSupported

Confirms that all aggregates are supported by the data layer

Ash.Resource.Verifiers.ValidateArgumentsToCodeInterface

Validate the arguments defined in the code interface and reject arguments that are not action attributes/arguments

Ash.Resource.Verifiers.ValidateEagerIdentities

Confirms that eager identities are not declared on a resource with no primary read.

Ash.Resource.Verifiers.ValidateManagedRelationshipOpts

Confirms that all action types declared on a resource are supported by its data layer

Ash.Resource.Verifiers.ValidateMultitenancy

Ensures that the multitenancy configuration is valid for the given resource

Ash.Resource.Verifiers.ValidatePrimaryKey

Validates and caches the primary key of a resource

Ash.Resource.Verifiers.ValidateRelationshipAttributes

Validates that all relationships point to valid fields

Ash.Resource.Verifiers.ValidateRelationshipAttributesMatch

Shows a warning on potentially incompatible relationship attributes.

Ash.Resource.Verifiers.VerifyActionsAtomic

Raises an error on update or destroy actions with `require_atomic?` set to true when it is known at compile time that they will not be atomic.

Ash.Resource.Verifiers.VerifyGenericActionReactorInputs

Returns an error if a generic action calls a Reactor module without specifying an argument for all expected inputs.

Ash.Resource.Verifiers.VerifyIdentityFields

Raises an error on potentially incompatible identity attributes.

Ash.Resource.Verifiers.VerifyPrimaryKeyPresent

Raises an error when a required primary key is missing

Ash.Resource.Verifiers.VerifyPrimaryReadActionHasNoArguments

Verifies that primary read actions do not have any arguments

Ash.Resource.Verifiers.VerifyReservedCalculationArguments

Verifies that standard context keys are not used as calculation arguments

Ash.Resource.Verifiers.VerifySelectedByDefault

Raises an error when a required primary key is missing

Ash.SatSolver

Tools for working with the satsolver that drives filter subset checking (for authorization)

Ash.Seed

Helpers for seeding data, useful for quickly creating lots of data either for database seeding or testing.

Ash.Sort

Utilities and types for sorting.

Ash.Test

Testing helpers for Ash.

Ash.ToTenant

Converts a value to a tenant. To add this to a resource, implement the protocol like so:application

Ash.Tracer

A behaviour for implementing tracing for an Ash application.

Ash.Tracer.Simple

A simple tracer that can send traces to the current process or call a module with the trace.

Ash.Tracer.Simple.Span

A span produced by `Ash.Tracer.Simple`

Ash.Type

The `Ash.Type` behaviour is used to define a value type in Ash.

Ash.Type.Atom

Stores an atom as a string in the database

Ash.Type.Binary

Represents a binary.

Ash.Type.Boolean

Represents a boolean.

Ash.Type.CiString

Stores a case insensitive string in the database

Ash.Type.Comparable

Helpers for working with `Comparable`

Ash.Type.Date

Represents a date in the database

Ash.Type.DateTime

Represents a datetime, with configurable precision and timezone.

Ash.Type.Decimal

Represents a decimal.

Ash.Type.DurationName

An interval of time, primarily meant to be used in expression functions

Ash.Type.Enum

A type for abstracting enums into a single type.

Ash.Type.File

A type that represents a file on the filesystem.

Ash.Type.File.Implementation

Behaviour for file implementations that are compatible with `Ash.Type.File`.

Ash.Type.File.Source

Protocol for allowing the casting of something into an `Ash.Type.File`.

Ash.Type.Float

Represents a float (floating point number)

Ash.Type.Function

Represents a function.

Ash.Type.Integer

Represents a simple integer

Ash.Type.Keyword

Represents a keyword list, stored as a `:map` in the database.

Ash.Type.Map

Represents a map stored in the database.

Ash.Type.Module

Stores a module as a string in the database.

Ash.Type.NaiveDatetime

Represents a Naive datetime

Ash.Type.NewType

Allows defining a new type that is the combination of an existing type and custom constraints

Ash.Type.String

Stores a string in the database.

Ash.Type.Struct

Represents a struct.

Ash.Type.Term

Represents a raw elixir term in the database

Ash.Type.Time

Represents a time in the database

Ash.Type.UUID

Represents a UUID.

Ash.Type.UUIDv7

Represents a UUID.

Ash.Type.Union

A union between multiple types, distinguished with a tag or by attempting to validate.

Ash.Type.UrlEncodedBinary

Represents a binary that attempts to decode input strings as a url encoded base64 string.

Ash.Type.UtcDatetime

Represents a utc datetime. A wrapper around `:datetime` for backwards compatibility.

Ash.Type.UtcDatetimeUsec

Represents a utc datetime with `nanosecond` precision. A wrapper around `:datetime` for backwards compatibility.

Ash.Type.Vector

Represents a vector.

Ash.UUID

Helpers for working with UUIDs

Ash.UUIDv7

Helpers for working with UUIDs version 7.

Ash.Union

A wrapper for values that are sourced from `Ash.Type.Union`.

Ash.Vector

A vector struct for Ash.

Comp

Provides utilities to implement and work with `Comparable` types

Comparable

Protocol which describes ordering relation for pair of types

Comparable.Type.Any.To.Any
Comparable.Type.Ash.CiString.To.Ash.CiString
Comparable.Type.Ash.CiString.To.BitString
Comparable.Type.Atom.To.BitString
Comparable.Type.BitString.To.Ash.CiString
Comparable.Type.BitString.To.Atom
Comparable.Type.BitString.To.Decimal
Comparable.Type.Date.To.Date
Comparable.Type.DateTime.To.DateTime
Comparable.Type.Decimal.To.BitString
Comparable.Type.Decimal.To.Decimal
Comparable.Type.Decimal.To.Float
Comparable.Type.Decimal.To.Integer
Comparable.Type.Float.To.Decimal
Comparable.Type.Integer.To.Decimal
Comparable.Type.List.To.List
Comparable.Type.Map.To.Map
Comparable.Type.NaiveDateTime.To.NaiveDateTime
Comparable.Type.Time.To.Time
Comparable.Type.Tuple.To.Tuple

## Mix Tasks

mix ash.codegen

Runs all codegen tasks for any extension on any resource/domain in your application.

mix ash.extend

Adds an extension or extensions to the domain/resource

mix ash.gen.base_resource

Generates a base resource

mix ash.gen.domain

Generates an Ash.Domain

mix ash.gen.enum

Generates an Ash.Type.Enum

mix ash.gen.resource

Generate and configure an Ash.Resource.

mix ash.generate_livebook

Generates a Livebook for each Ash domain.

mix ash.generate_policy_charts

Generates a Mermaid Flow Chart for a given resource's policies.

mix ash.generate_resource_diagrams

Generates a Mermaid Resource Diagram for each Ash domain.

mix ash.install

Installs Ash into a project. Should be called with `mix igniter.install ash`

mix ash.migrate

Runs all migration tasks for any extension on any resource/domain in your application.

mix ash.patch.extend

Adds an extension or extensions to the domain/resource. Use `ash.extend` instead.

mix ash.reset

Runs all tear down tasks for any extension on any resource/domain in your application, followed by setup tasks.

mix ash.rollback

Runs all rollback tasks for any extension on any resource/domain in your application.

mix ash.setup

Runs all setup tasks for any extension on any resource/domain in your application.

mix ash.tear_down

Runs all tear down tasks for any extension on any resource/domain in your application.

Next Page → Home