View Source Ash.Resource.Info (ash v1.53.2)

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

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

Get a calculation by name

Returns all calculations of a resource

A list of all changes for the resource

Returns the configured default actions

Get a field from a resource by name

A list of identities for the resource

Get an identity by name from the resource

Returns true if the load or path to load has been loaded

Get the multitenancy strategy for a resource

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

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

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

Determine if a field is sortable by name

Sets a loaded key or path to a key back to its original unloaded stated

Sets a list of loaded key or paths to a key back to their original unloaded stated

A list of all validations for the resource

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(Ash.Resource.t(), atom() | String.t()) ::
  Ash.Resource.Aggregate.t() | nil

Get an aggregate by name

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

Returns all aggregates of a resource

Link to this function

attribute(resource, name)

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

Get an attribute name from the resource

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

Returns all attributes of a resource

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

A list of authorizers to be used when accessing

@spec base_filter(Ash.Resource.t()) :: term()
Link to this function

calculation(resource, name)

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

Get a calculation by name

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

Returns all calculations of a resource

A list of all changes for the resource

@spec changes(Ash.Resource.t(), :create | :update | :destroy) :: [
  Ash.Resource.Validation.t() | Ash.Resource.Change.t()
]
Link to this function

default_actions(resource)

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

Returns the configured default actions

Link to this function

default_context(resource)

View Source
@spec default_context(Ash.Resource.t()) :: term()
Link to this function

define_interface_for(resource)

View Source
@spec define_interface_for(Ash.Resource.t()) :: atom() | nil
Link to this function

define_interface_in_resource?(resource)

View Source
@spec define_interface_in_resource?(Ash.Resource.t()) :: boolean()
@spec description(Ash.Resource.t()) :: String.t() | nil
@spec embedded?(Ash.Resource.t()) :: boolean()
@spec extensions(Ash.Resource.t()) :: [module()]

Get a field from a resource by name

Link to this function

get_metadata(record, key_or_path)

View Source
@spec get_metadata(Ash.Resource.record(), atom() | [atom()]) :: term()
@spec identities(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(Ash.Resource.t(), atom()) :: Ash.Resource.Identity.t() | nil

Get an identity by name from the resource

@spec interfaces(Ash.Resource.t()) :: [Ash.Resource.Interface.t()]
@spec loaded?(
  nil | [Ash.Resource.record()] | Ash.Resource.record() | Ash.Page.page(),
  atom() | [atom()]
) :: boolean()

Returns true if the load or path to load has been loaded

Link to this function

multitenancy_attribute(resource)

View Source
@spec multitenancy_attribute(Ash.Resource.t()) :: atom() | nil
Link to this function

multitenancy_global?(resource)

View Source
@spec multitenancy_global?(Ash.Resource.t()) :: atom() | nil
Link to this function

multitenancy_parse_attribute(resource)

View Source
@spec multitenancy_parse_attribute(Ash.Resource.t()) :: {atom(), atom(), [any()]}
Link to this function

multitenancy_source(resource)

View Source
@spec multitenancy_source(Ash.Resource.t()) :: atom() | nil
Link to this function

multitenancy_strategy(resource)

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

Get the multitenancy strategy for a resource

Link to this function

multitenancy_template(resource)

View Source
@spec multitenancy_template(Ash.Resource.t()) :: atom() | nil
@spec notifiers(Ash.Resource.t()) :: [module()]

A list of notifiers to be used when accessing

@spec preparations(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(Ash.Resource.t()) :: [atom()]

A list of field names corresponding to the primary key

Link to this function

public_aggregate(resource, name)

View Source
@spec public_aggregate(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(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(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(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(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(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

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(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
@spec put_metadata(Ash.Resource.record(), atom(), term()) :: Ash.Resource.record()
Link to this function

related(resource, relationship)

View Source
@spec related(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(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
Link to this function

selected?(record, field)

View Source
@spec selected?(Ash.Resource.record(), atom()) :: boolean()
Link to this function

set_metadata(record, map)

View Source
@spec set_metadata(Ash.Resource.record(), map()) :: Ash.Resource.record()
Link to this function

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

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

Determine if a field is sortable by name

Sets a loaded key or path to a key back to its original unloaded stated

Link to this function

unload_many(data, paths)

View Source
@spec unload_many(
  nil | [Ash.Resource.record()] | Ash.Resource.record() | Ash.Page.page(),
  [atom()] | [[atom()]]
) :: nil | [Ash.Resource.record()] | Ash.Resource.record() | Ash.Page.page()

Sets a list of loaded key or paths to a key back to their original unloaded stated

@spec validations(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(Ash.Resource.t(), :create | :update | :destroy) :: [
  Ash.Resource.Validation.t()
]