View Source Ash.Resource.Info (ash v2.9.11)

Introspection for resources

Link to this section Summary

Functions

Returns the action with the matching name and type on the resource

Returns all actions of a resource

Get an aggregate by name

Gets the type of an aggregate for a given resource.

Returns all aggregates of a resource

Get an attribute name from the resource

Returns all attributes of a resource

A list of authorizers to be used when accessing

The base filter of the resource

Get a calculation by name

The list of code interface calculation definitions.

Returns all calculations of a resource

A list of all changes for the resource

A list of all changes for the resource for a given action type

Returns the configured default actions

The default context of the resource

The Api to define the interface for, when defining it in the resource

The description of the resource

Whether or not the resource is an embedded resource

Get a field from a resource by name

Returns all attributes, aggregates, calculations and relationships of a resource

A list of identities for the resource

Get an identity by name from the resource

The list of code interface definitions.

The multitenancy attribute for a resource

The MFA to parse the tenant from the attribute

The function to parse the tenant from the attribute

The multitenancy strategy for a resource

The template for creating the tenant name

A list of notifiers to be used when accessing

Returns the primary action of the given type

Returns the primary action of a given type

A list of field names corresponding to the primary key

Wether or not all primary key attributes can be compared with simple_equality

Get an aggregate by name

Returns all public aggregates of a resource

Get a public attribute name from the resource

Returns all public attributes of a resource

Get a public calculation by name

Returns all public calculations of a resource

Get a public field from a resource by name

Returns all public attributes, aggregates, calculations and relationships of a resource

Get a public relationship by name or path

Returns all public relationships of a resource

Get a relationship by name or path

Returns all relationships of a resource

Whether or not a given module is a resource module

Retrieves a relationship path from the resource related by path, to the provided resource.

The short_name of the resource

A list of simple notifiers (require no DSL, used to avoid compile time dependencies)

Determine if a field is sortable by name

The trace_name of the resource

A list of all validations for the resource

A list of all validations for the resource for a given action type

Link to this section Functions

Link to this function

action(resource, name, type \\ nil)

View Source

Returns the action with the matching name and type on the resource

Returns all actions of a resource

Link to this function

aggregate(resource, name)

View Source
@spec aggregate(Spark.Dsl.t() | Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Aggregate.t() | nil

Get an aggregate by name

Link to this function

aggregate_type(resource, aggregate)

View Source
@spec aggregate_type(
  Spark.Dsl.t() | Ash.Resource.t(),
  Ash.Resource.Aggregate.t() | atom()
) ::
  {:ok, Ash.Type.t()} | {:error, String.t()}

Gets the type of an aggregate for a given resource.

@spec aggregates(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Aggregate.t()]

Returns all aggregates of a resource

Link to this function

attribute(resource, name)

View Source
@spec attribute(Spark.Dsl.t() | Ash.Resource.t(), String.t() | atom()) ::
  Ash.Resource.Attribute.t() | nil

Get an attribute name from the resource

@spec attributes(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Attribute.t()]

Returns all attributes of a resource

@spec authorizers(Spark.Dsl.t() | Ash.Resource.t()) :: [module()]

A list of authorizers to be used when accessing

@spec base_filter(Spark.Dsl.t() | Ash.Resource.t()) :: term()

The base filter of the resource

Link to this function

calculation(resource, name)

View Source
@spec calculation(Spark.Dsl.t() | Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Calculation.t() | nil

Get a calculation by name

Link to this function

calculation_interfaces(resource)

View Source
@spec calculation_interfaces(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Interface.t()
]

The list of code interface calculation definitions.

@spec calculations(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Calculation.t()]

Returns all calculations of a resource

A list of all changes for the resource

@spec changes(Spark.Dsl.t() | Ash.Resource.t(), :create | :update | :destroy) :: [
  Ash.Resource.Validation.t() | Ash.Resource.Change.t()
]

A list of all changes for the resource for a given action type

Link to this function

default_actions(resource)

View Source
@spec default_actions(Spark.Dsl.t() | Ash.Resource.t()) :: [
  :create | :read | :update | :destroy
]

Returns the configured default actions

Link to this function

default_context(resource)

View Source
@spec default_context(Spark.Dsl.t() | Ash.Resource.t()) :: term()

The default context of the resource

Link to this function

define_interface_for(resource)

View Source
@spec define_interface_for(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil

The Api to define the interface for, when defining it in the resource

@spec description(Spark.Dsl.t() | Ash.Resource.t()) :: String.t() | nil

The description of the resource

@spec embedded?(Spark.Dsl.t() | Ash.Resource.t()) :: boolean()

Whether or not the resource is an embedded resource

Get a field from a resource by name

Returns all attributes, aggregates, calculations and relationships of a resource

Link to this function

get_metadata(record, key_or_path)

View Source
This function is deprecated. Use `Ash.Resource.get_metadata/2` instead.

See Ash.Resource.get_metadata/2.

@spec identities(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Identity.t()]

A list of identities for the resource

Link to this function

identity(resource, name)

View Source
@spec identity(Spark.Dsl.t() | Ash.Resource.t(), atom()) ::
  Ash.Resource.Identity.t() | nil

Get an identity by name from the resource

@spec interfaces(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Interface.t()]

The list of code interface definitions.

Link to this function

multitenancy_attribute(resource)

View Source
@spec multitenancy_attribute(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil

The multitenancy attribute for a resource

Link to this function

multitenancy_global?(resource)

View Source
@spec multitenancy_global?(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil

The MFA to parse the tenant from the attribute

Link to this function

multitenancy_parse_attribute(resource)

View Source
@spec multitenancy_parse_attribute(Spark.Dsl.t() | Ash.Resource.t()) ::
  {atom(), atom(), [any()]}

The function to parse the tenant from the attribute

Link to this function

multitenancy_strategy(resource)

View Source
@spec multitenancy_strategy(Spark.Dsl.t() | Ash.Resource.t()) ::
  :context | :attribute | nil

The multitenancy strategy for a resource

Link to this function

multitenancy_template(resource)

View Source
@spec multitenancy_template(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil

The template for creating the tenant name

@spec notifiers(Spark.Dsl.t() | Ash.Resource.t()) :: [module()]

A list of notifiers to be used when accessing

@spec preparations(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Preparation.t()]
Link to this function

primary_action!(resource, type)

View Source

Returns the primary action of the given type

Link to this function

primary_action(resource, type)

View Source

Returns the primary action of a given type

@spec primary_key(Spark.Dsl.t() | Ash.Resource.t()) :: [atom()]

A list of field names corresponding to the primary key

Link to this function

primary_key_simple_equality?(resource)

View Source
@spec primary_key_simple_equality?(Spark.Dsl.t() | Ash.Resource.t()) :: boolean()

Wether or not all primary key attributes can be compared with simple_equality

Link to this function

public_aggregate(resource, name)

View Source
@spec public_aggregate(Spark.Dsl.t() | Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Aggregate.t() | nil

Get an aggregate by name

Link to this function

public_aggregates(resource)

View Source
@spec public_aggregates(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Aggregate.t()
]

Returns all public aggregates of a resource

Link to this function

public_attribute(resource, name)

View Source
@spec public_attribute(Spark.Dsl.t() | Ash.Resource.t(), String.t() | atom()) ::
  Ash.Resource.Attribute.t() | nil

Get a public attribute name from the resource

Link to this function

public_attributes(resource)

View Source
@spec public_attributes(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Attribute.t()
]

Returns all public attributes of a resource

Link to this function

public_calculation(resource, name)

View Source
@spec public_calculation(Spark.Dsl.t() | Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Calculation.t() | nil

Get a public calculation by name

Link to this function

public_calculations(resource)

View Source
@spec public_calculations(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Calculation.t()
]

Returns all public calculations of a resource

Link to this function

public_field(resource, name)

View Source

Get a public field from a resource by name

Returns all public attributes, aggregates, calculations and relationships of a resource

Link to this function

public_relationship(resource, relationship_name)

View Source

Get a public relationship by name or path

Link to this function

public_relationships(resource)

View Source
@spec public_relationships(Spark.Dsl.t() | Ash.Resource.t()) :: [
  Ash.Resource.Relationships.relationship()
]

Returns all public relationships of a resource

Link to this function

put_metadata(record, key, term)

View Source
This function is deprecated. Use `Ash.Resource.put_metadata/3` instead.

See Ash.Resource.put_metadata/3.

Link to this function

related(resource, relationship)

View Source
@spec related(
  Spark.Dsl.t() | Ash.Resource.t(),
  atom() | String.t() | [atom() | String.t()]
) ::
  Ash.Resource.t() | nil
Link to this function

relationship(resource, relationship_name)

View Source
@spec relationship(
  Spark.Dsl.t() | Ash.Resource.t(),
  atom() | String.t() | [atom() | String.t()]
) ::
  Ash.Resource.Relationships.relationship() | nil

Get a relationship by name or path

Returns all relationships of a resource

@spec resource?(module()) :: boolean()

Whether or not a given module is a resource module

Link to this function

reverse_relationship(resource, path, acc \\ [])

View Source

Retrieves a relationship path from the resource related by path, to the provided resource.

Link to this function

selected?(record, field)

View Source
This function is deprecated. Use `Ash.Resource.selected?/2` instead.

See Ash.Resource.selected?/2.

Link to this function

set_metadata(record, map)

View Source
This function is deprecated. Use `Ash.Resource.set_metadata/2` instead.

See Ash.Resource.set_metadata/2.

@spec short_name(Spark.Dsl.t() | Ash.Resource.t()) :: String.t() | nil

The short_name of the resource

Link to this function

simple_notifiers(resource)

View Source
@spec simple_notifiers(Spark.Dsl.t() | Ash.Resource.t()) :: [module()]

A list of simple notifiers (require no DSL, used to avoid compile time dependencies)

Link to this function

sortable?(resource, name, opts \\ [])

View Source
@spec sortable?(Spark.Dsl.t() | Ash.Resource.t(), String.t() | atom(),
  pagination_type: Ash.Page.type(),
  include_private?: boolean()
) :: boolean()

Determine if a field is sortable by name

@spec trace_name(Spark.Dsl.t() | Ash.Resource.t()) :: String.t() | nil

The trace_name of the resource

Link to this function

unload(record, key_or_path)

View Source
This function is deprecated. Use `Ash.Resource.unload/2` instead.

See Ash.Resource.unload/2.

Link to this function

unload_many(record, loads)

View Source
This function is deprecated. Use `Ash.Resource.unload_many/2` instead.

See Ash.Resource.unload_many/2.

@spec validations(Spark.Dsl.t() | Ash.Resource.t()) :: [Ash.Resource.Validation.t()]

A list of all validations for the resource

Link to this function

validations(resource, type)

View Source
@spec validations(Spark.Dsl.t() | Ash.Resource.t(), :create | :update | :destroy) :: [
  Ash.Resource.Validation.t()
]

A list of all validations for the resource for a given action type