View Source API Reference ash v3.4.36
Modules
The primary interface to call actions and interact with resources.
Input for a custom action
A utility for limiting the number of concurrent async operations
The interface for an ash authorizer
The return value for bulk actions.
Changesets are used to create and update data in Ash.
Tools for introspecting managed relationships.
A value placed in changeset.data to indicate that the original data is not available
Represents a case insensitive string
Used to define the functions of a code interface for a resource.
Functions for working with the context provided to various callbacks in Ash.
A module for defining custom functions that can be called in Ash expressions.
The behaviour for backing resource actions with persistence layers.
An ETS (Erlang Term Storage) backed Ash Datalayer, for testing and lightweight usage.
Introspection helpers for the Ets data layer
An Mnesia backed Ash Datalayer.
Introspection helpers for Ash.DataLayer.Mnesia
A data layer that returns structs.
Ensures that all identities have a pre_check_with
configured, or raises.
A domain allows you to interact with your resources, and holds domain-wide configuration.
A resource reference in a domain
Codemods for working with Ash.Domain modules
Introspection tools for Ash.Domain
Generate Mermaid diagrams from a specified domain.
Generate a Livebook from a specified domain.
Ensures that all resources for a given domain are not embeds.
Validate the arguments defined in the code interface and reject arguments that are not action attributes/arguments
Ensures that all related resources are included in a domain.
Tools and utilities used by Ash to manage and conform errors
Used when an invalid value is provided for an action argument
Used when an actor is referenced in a filter template, but no actor exists
Used when an invalid value is provided for an action argument
Used when an invalid value is provided for an attribute change
Used when a change is provided that covers multiple attributes/relationships
Used when an invalid value is provided for a relationship change
Used when a change is provided for an attribute that does not exist
Used when a change is provided for an relationship that does not exist
Used when an attribute or relationship is required
Used when a stale record is attempted to be updated or deleted
Tooling for creating an Ash exception
Used when authorization for an action fails
Used when a create action would be filtered
Used when a domain that has require_actor? true
is provided no actor
Used when a domain that has authorize :always
is provided authorize?: false
Raised in cases where access to a specific field was prevented
Used when initial data was not supplied when it was required
Used when unreachable code/conditions are reached in the framework
A placeholder exception that the user should never see
Raised when policy authorization for an action fails
Used when an unknown/generic framework error occurs
Used when unreachable code/conditions are reached in the framework
Used when a change that is only atomic cannot be done atomically
Used when unreachable code/conditions are reached in the framework
Used when a callback returns an invalid type
Used when an action that must be atomic cannot be done atomically
Used when the sycnrhonous engine cannot proceed
The top level invalid error
Used when page option is passed but pagination is not enabled.
Used when atomics for the given action type are not not supported by the data layer, but one is used.
Used when an invalid primary key is given to Ash.get/2
Used when no limit is provided, pagination is required, and no default page size is configured
Used when multiple results are returned in a case where only one result was expected
Used when an identity name is used that does not reference identity on the resource
Used when an identity name is used that does not reference identity on the resource
Used when an action name is provided that doesn't exist
Used when an action name is provided that doesn't exist
Used when an input is provided to an action or calculation that is not accepted
Used when a resource or alias is provided that doesn't exist
Used when page[:count] option is passed but the action's pagination is not countable.
Used when Ash.stream is used with an action that does not support keyset pagination
Used when page: false
is provided but pagination is required
Used when a resource or alias is provided that cannot be used with the given domain
Used when a tenant is not specified
Used when a request to a domain times out.
Used when timeouts are not supported by the data layer, but one is set
Used when a given resource is unavailable.
Used when an invalid query is provided in a load
Used when attempting to load a relationship that does not exist
Used when a value is provided for a keyset that cannot be Base64 decoded.
Used when the data_layer does not support aggregates, or filtering/sorting them
Used when a calculation requires a primary key but was not supplied with one
Used when the data_layer does not support calculations, or filtering/sorting them
Used when an invalid value is provided for an action argument
Used when an invalid value is provided for a calculation argument
Used when an invalid expression is used in a filter
Used when an invalid reference is used in a filter
Used when an invalid value is provided for a filter
Used when an invalid limit is provided
Used when an invalid load is provided
Used when an invalid offset is provided
Used when an invalid page option is provided
A generic error that can be used to add an error to a query for a specific field
Used when an invalid sort order is provided
Used when the data_layer does not support a given lock type
Due to the filter-based implementation of keyset pagination, it cannot be used with sorts on calculations.
Used when a resource would be read but has no read action
Used when an attribute that doesn't exist is used in a query
Used when a field(attrbute, calculation, aggregate or relationship) that doesn't exist is used in a query
Used when a filter predicate that does not exist is referenced
Used when an function that doesn't exist is used in a query
Used when an operator that doesn't exist is used in a query
Used when an relationship that doesn't exist is used in a query
Used when an entity that not exist is referenced
Used when a relationship is filtered and the destination does not have a default read action
Used when an actor is referenced in a filter template, but no actor exists
Used when a filter or argument is required in a query
Used when attempting to sort on a field that cannot be used for sorting
Used when the data_layer does not support a provided predicate
Used when no data was provided to the simple data layer
A placeholder for a stacktrace so that we can avoid printing it everywhere
The top level unknown error container
Used when an unknown error occurs
Tools to build Ash expressions
A behavior of additional callbacks that extensions can implement, specific to Ash.
The representation of a filter in Ash.
Represents a predicate which can be simplified and/or compared with other predicates
Checks a record to see if it matches a filter statement.
Represents a simplified filter, with a simple list of predicates
A negated predicate
Represents a field that was hidden due to authorization rules.
Tools for generating input to Ash resource actions, as well as for seeds.
Codemods and utilities for working with Ash & Igniter
Helpers for Ash Mix tasks.
Used when a field hasn't been loaded or selected.
A notifier is an extension that receives various events
Represents a notification that will be handled by a resource's notifiers
A builtin notifier to help you publish events over any kind of pub-sub tooling.
Introspection helpers for Ash.Notifier.PubSub
Represents a configured publication from the pubsub notifier on an Ash.Resource
Helpers for working with nimble options
Types for Ash pages
A page of results from keyset
based pagination.
A page of results from offset
based pagination.
Helpers for working with the Plug connection.
An authorization extension for ash resources.
Adds field policies for any missing fields
Cache field policies for each field
Generates policy mermaid charts
A behaviour for declaring checks, which can be used to easily construct authorization rules.
This check is true when the current action is being run "through" a relationship.
This check is true when the action name matches the provided action name.
This check is true when the action type matches the provided type
This check is true when the value of the specified attribute of the actor equals the specified value.
This check is true when there is an actor specified, and false when the actor is nil
.
The global authorization checks built into ash
This check is true when attribute changes correspond to the provided options.
This check is true when the specified relationship is changing
This check is true when the value of the specified key or path in the changeset or query context equals the specified value.
The check module used for expr
s in policies
This check is true when the field provided is being referenced anywhere in a filter statement.
This check is true when the field or relationship, or path to field, is being loaded and false when it is not.
This check is true when the specified function returns true
This check passes if the data relates to the actor via the specified relationship or path of relationships.
This check is true when the specified relationship is being changed to the current actor.
This check is true when the resource matches the provided resource name or names.
This check is true when the field is being selected and false when it is not.
This check is always the result provided
Represents a field policy in an Ash.Resource
A type of check that is represented by a filter statement
An authorization extension for ash resources.
Represents a policy on an Ash.Resource
Represents a policy group on an Ash.Resource
A type of check that operates only on request context, never on the data
Helpers for working with processes and Ash actions.
A data structure for reading data from a resource.
Represents an aggregated association value
Represents a boolean expression
Represents a calculated attribute requested on a query
Represents a function call/AST node in an Ash query expression
Determines if a given related entity exists.
A function is a predicate with an arguments list.
Subtracts the given interval from the current time in UTC.
Gets an element in the list by index
Constructs a composite type in a way that is natively understood by the data layer
Returns true if the first string contains the second.
Returns the count of nil.
Adds the given interval to the current time in UTC
Adds the given interval to the current time in UTC
If the predicate is truthy, the provided exception is raised with the provided values.
Adds the given interval from the current time in UTC.
Adds the given interval from the current time in UTC.
Gets the value at the provided path in the value, which must be a map or embed.
If predicate is truthy, then the second argument is returned, otherwise the third.
true if the provided field is nil
Runs the provided MFA and returns the result as a known value.
Returns the length of a list attribute defined by the composite type {:array, Type}
.
Multiplies the value by negative one
Returns the current datetime
Rounds a float, decimal or integer to the given number of points
Downcase a string
Joins a list of values.
Trims whitespace from a string
Split a string into a list of strings
Trims whitespace from a string
Returns the current date.
Casts the value to a given type. Can also be used to provide type hints to data layers, where appropriate.
Represents the negation of the contained expression
An operator is a predicate with a left
and a right
left == right
left > right
left >= right
left in [1, 2, 3]
left is_nil true/false
left < right
left <= right
left != right
Used to access values from the "source" of a given expression.
Represents a relation/attribute reference
Returns the conflicting new information.
Ash.Reactor
is a Reactor
extension
which provides steps for working with Ash resources and actions.
The Reactor step which is used to execute generic actions.
A reactor step which runs a step-module or an anonymous function, and enqueues any returned notifications before returning.
The Reactor stop which is used to execute create actions in bulk.
The Reactor stop which is used to execute create actions in bulk.
The Reactor step which is used to execute change steps.
The Reactor step which is used to execute create actions.
The Reactor step which is used to execute update actions.
The action
entity for the Ash.Reactor
reactor extension.
Add a load statement to an action.
Responsible for transforming actions.
Specify the actor used to execute an action.
The ash_step DSL module.
The bulk_create
entity for the Ash.Reactor
reactor extension.
The bulk_update
entity for the Ash.Reactor
reactor extension.
The change
entity for the Ash.Reactor
reactor extension.
Specify context to merge into an action's context.
The create
entity for the Ash.Reactor
reactor extension.
The destroy
entity for the Ash.Reactor
reactor extension.
The inputs
entity for the Ash.Reactor
reactor extension.
The load
step entity for the Ash.Reactor
reactor extension.
Ensures that the required middlewares are added to the Reactor.
The read
entity for the Ash.Reactor
reactor extension.
The read_one
entity for the Ash.Reactor
reactor extension.
Specify the tenant used to execute an action.
The transaction
entity for the Ash.Reactor
reactor extension.
The update
entity for the Ash.Reactor
reactor extension.
The Reactor step which is used to execute load steps.
A custom step which merges any number of inputs
results into a single map.
Reactor middleware used to collect and emit notifications upon successful completion of the Reactor.
The Reactor step which is used to execute get actions.
The Reactor step which is used to execute read actions.
Reactor middleware which threads Ash's tracing information through to new processes spawned by Reactor.
The Reactor step which is used to wrap other steps in an Ash data layer transaction.
The Reactor step which is used to execute update actions.
A resource is a static definition of an entity in your system.
Types for Ash actions
Represents a custom action on a resource.
Represents an argument to an action
Represents a create action on a resource.
Represents a destroy action on a resource.
An implementation of a generic action.
The context passed into generic action functions
Represents metadata from an action
Represents a read action on a resource.
Represents the pagination configuration of a read action
Represents a update action on a resource.
Represents a named aggregate on the resource that can be loaded
The root behavior for a custom aggregate.
Represents a join filter on a resource aggregate
Represents an attribute on a resource
Helpers for building attributes
Tools for transforming resources in DSL Transformers.
The behaviour for defining a module calculation, and the struct for storing a defined calculation.
An argument to a calculation
Built in calculations that are automatically imported in the calculations section
The context and arguments of a calculation
Loads an attribute as a calculation.
Loads a relationship as a calculation.
Represents a function that evaluates a calculation in a resource's code interface
The behaviour for an action-specific resource change.
Built in changes that are available to all resources
Cascade a resource's destroy action to a related resource's destroy action.
Cascade a resource's update action to a related resource's update action.
The context for a change.
Refetches the record being updated or destroyed, and locks it with the given type.
Refetches the record being updated or destroyed, and locks it for update.
Increments an attribute's value by the amount specified, which defaults to 1.
Apply an "optimistic lock" on a record being updated or destroyed.
Introspection target for a filter for read actions and relationships
Represents a unique constraint on a resource
Codemods for working with Ash.Resource modules
Introspection for resources
Represents a function in a resource's code interface
A module to implement manual create actions.
The context passed into manual update action functions
A module to implement manual destroy actions.
The context passed into manual update action functions
A module to implement manual read actions.
A module to implement manual relationships.
The context passed into manual relationship functions
A module to implement manual update actions.
The context passed into manual update action functions
The behaviour for an action-specific query preparation.
Builtin query preparations
The context for a preparation.
Types Ash relationships
Represents a belongs_to relationship on a resource
Represents a has_many relationship on a resource
Represents a has_one relationship on a resource
Represents a many_to_many relationship on a resource
Persists attribute_names and attributes_by_name.
Creates the attribute for belongs_to relationships that have define_attribute?: true
Stores the set of valid input keys for each action
Persists commonly used calculation information.
Validates and caches the primary key of a resource
Persists commonly used relationship information.
Stores the set of unique keys for a resource
Creates an automatically named has_many
relationship for each many_to_many.
Sets the default accept
for each action
Transform any read actions which contain a get_by
option.
Guesses the destination_attribute
for has many and has one relationships unless provided
Guesses the destination_attribute_on_join_resource
for many to many relationships unless provided.
Guesses the source_attribute_on_join_resource
for many to many relationships unless provided.
Ensures that all actions have unique names.
Confirms that a resource does not have multiple fields(attributes, calculations, aggregates, and relationships) with the same name.
Validates the primary action configuration
Sets the source
key on relationships to be the resource they were defined on
Persists global changes/validations and what type they go on.
Represents a validation in Ash.
Validates that the action is the specified action.
Built in validations that are available to all resources
Context for a validation.
Ensures that the field at the end of the path is an attribute or calculation.
Confirms that a resource does not use reserved names for field names.
Validates that accept and reject lists only contain valid attributes
Confirms that all action types declared on a resource are supported by its data layer
Confirms that all aggregates are supported by the data layer
Validate the arguments defined in the code interface and reject arguments that are not action attributes/arguments
Confirms that eager identities are not declared on a resource with no primary read.
Confirms that all action types declared on a resource are supported by its data layer
Ensures that the multitenancy configuration is valid for the given resource
Validates and caches the primary key of a resource
Validates that all relationships point to valid fields
Shows a warning on potentially incompatible relationship attributes.
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.
Returns an error if a generic action calls a Reactor module without specifying an argument for all expected inputs.
Raises an error on potentially incompatible identity attributes.
Raises an error when a required primary key is missing
Verifies that standard context keys are not used as calculation arguments
Raises an error when a required primary key is missing
Tools for working with the satsolver that drives filter subset checking (for authorization)
Helpers for seeding data, useful for quickly creating lots of data either for database seeding or testing.
Utilities and types for sorting.
Testing helpers for Ash.
Converts a value to a tenant. To add this to a resource, implement the protocol like so:application
A behaviour for implementing tracing for an Ash application.
A simple tracer that can send traces to the current process or call a module with the trace.
A span produced by Ash.Tracer.Simple
Stores an atom as a string in the database
Represents a binary.
Represents a boolean.
Stores a case insensitive string in the database
Helpers for working with Comparable
Represents a date in the database
Represents a datetime, with configurable precision and timezone.
Represents a decimal.
An interval of time, primarily meant to be used in expression functions
A type for abstracting enums into a single type.
A type that represents a file on the filesystem.
Behaviour for file implementations that are compatible with Ash.Type.File
.
Protocol for allowing the casting of something into an Ash.Type.File
.
Represents a float (floating point number)
Represents a function.
Represents a simple integer
Represents a keyword list, stored as a :map
in the database.
Represents a map stored in the database.
Stores a module as a string in the database.
Represents a Naive datetime
Allows defining a new type that is the combination of an existing type and custom constraints
Stores a string in the database.
Represents a struct.
Represents a raw elixir term in the database
Represents a time in the database
Represents a UUID.
Represents a UUID.
A union between multiple types, distinguished with a tag or by attempting to validate.
Represents a binary that attempts to decode input strings as a url encoded base64 string.
Represents a utc datetime. A wrapper around :datetime
for backwards compatibility.
Represents a utc datetime with nanosecond
precision. A wrapper around :datetime
for backwards compatibility.
Represents a vector.
Helpers for working with UUIDs
Helpers for working with UUIDs version 7.
A wrapper for values that are sourced from Ash.Type.Union
.
A vector struct for Ash.
Provides utilities to implement and work with Comparable
types
Protocol which describes ordering relation for pair of types
Mix Tasks
Runs all codegen tasks for any extension on any resource/domain in your application.
Generates a base resource
Generates an Ash.Domain
Generates an Ash.Type.Enum
Generate and configure an Ash.Resource.
Generates a Livebook for each Ash domain.
Generates a Mermaid Flow Chart for a given resource's policies.
Generates a Mermaid Resource Diagram for each Ash domain.
Installs Ash into a project. Should be called with mix igniter.install ash
Runs all migration tasks for any extension on any resource/domain in your application.
Adds an extension or extensions to the domain/resource
Runs all tear down tasks for any extension on any resource/domain in your application, followed by setup tasks.
Runs all rollback tasks for any extension on any resource/domain in your application.
Runs all setup tasks for any extension on any resource/domain in your application.
Runs all tear down tasks for any extension on any resource/domain in your application.