View Source Ash.Resource.Builder (ash v3.4.36)

Tools for transforming resources in DSL Transformers.

Summary

Functions

Builds and adds an aggregate to a resource

Builds and adds an attribute to a resource

Builds and adds a calculation to a resource

Builds and adds an calculation interface to a resource

Builds and adds a change

Builds and adds a create_timestamp to a resource

Builds and adds an interface to a resource

Builds and adds a new action unless an action with that name already exists

Builds and adds an aggregate unless an aggregate with that name already exists

Builds and adds an attribute unless an attribute with that name already exists

Builds and adds a calculation unless a calculation with that name already exists

Builds and adds an calculation interface unless an calculation interface with that name already exists

Builds and adds a create_timestamp unless a create_timestamp with that name already exists

Builds and adds a new identity unless an identity with that name already exists

Builds and adds an interface unless an interface with that name already exists

Builds and adds a new relationship unless a relationship with that name already exists

Builds and adds an update_timestamp unless an update_timestamp with that name already exists

Builds and adds a preparation

Builds and adds an update_timestamp

Builds an action change

Builds a calculation with the given name, type, and options

Builds an attribute with the given name, type, and options

Builds a calculation with the given name, type, and options

Builds an calculation interface with the given name, type, and options

Builds an create_timestamp with the given name, type, and options

Builds an interface with the given name, type, and options

Builds a pagination object

Builds a preparation

Builds an update_timestamp with the given name, type, and options

Builds and adds an action to the front of the actions list

Functions

Link to this function

add_action(dsl_state, type, name, opts \\ [])

View Source
@spec add_action(
  Spark.Dsl.Builder.input(),
  type :: Ash.Resource.Actions.action_type(),
  name :: atom(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an action

Link to this function

add_aggregate(dsl_state, name, kind, relationship_path, opts \\ [])

View Source
@spec add_aggregate(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  kind :: Ash.Query.Aggregate.kind(),
  relationship_path :: atom() | [atom()],
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an aggregate to a resource

Link to this function

add_attribute(dsl_state, name, type, opts \\ [])

View Source
@spec add_attribute(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  type :: Ash.Type.t(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an attribute to a resource

Link to this function

add_calculation(dsl_state, name, type, calculation, opts \\ [])

View Source
@spec add_calculation(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  type :: Ash.Type.t(),
  calculation :: module() | {module(), Keyword.t()},
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds a calculation to a resource

Link to this function

add_calculation_interface(dsl_state, name, opts \\ [])

View Source
@spec add_calculation_interface(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an calculation interface to a resource

Link to this function

add_change(dsl_state, ref, opts \\ [])

View Source
@spec add_change(
  Spark.Dsl.Builder.input(),
  ref :: module() | {module(), Keyword.t()},
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds a change

Link to this function

add_create_timestamp(dsl_state, name, opts \\ [])

View Source
@spec add_create_timestamp(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds a create_timestamp to a resource

Link to this function

add_identity(dsl_state, name, fields, opts \\ [])

View Source
@spec add_identity(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  fields :: atom() | [atom()],
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an identity

Link to this function

add_interface(dsl_state, name, opts \\ [])

View Source
@spec add_interface(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an interface to a resource

Link to this function

add_new_action(dsl_state, type, name, opts \\ [])

View Source
@spec add_new_action(
  Spark.Dsl.Builder.input(),
  type :: Ash.Resource.Actions.action_type(),
  name :: atom(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds a new action unless an action with that name already exists

Link to this function

add_new_aggregate(dsl_state, name, kind, relationship_path, opts \\ [])

View Source
@spec add_new_aggregate(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  kind :: Ash.Query.Aggregate.kind(),
  relationship_path :: atom() | [atom()],
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an aggregate unless an aggregate with that name already exists

Link to this function

add_new_attribute(dsl_state, name, type, opts \\ [])

View Source
@spec add_new_attribute(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  type :: Ash.Type.t(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an attribute unless an attribute with that name already exists

Link to this function

add_new_calculation(dsl_state, name, type, calculation, opts \\ [])

View Source
@spec add_new_calculation(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  type :: Ash.Type.t(),
  calculation :: module() | {module(), Keyword.t()} | Ash.Expr.t(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds a calculation unless a calculation with that name already exists

Link to this function

add_new_calculation_interface(dsl_state, name, opts \\ [])

View Source
@spec add_new_calculation_interface(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an calculation interface unless an calculation interface with that name already exists

Link to this function

add_new_create_timestamp(dsl_state, name, opts \\ [])

View Source
@spec add_new_create_timestamp(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  opts :: Keyword.t()
) ::
  Spark.Dsl.Builder.result()

Builds and adds a create_timestamp unless a create_timestamp with that name already exists

Link to this function

add_new_identity(dsl_state, name, fields, opts \\ [])

View Source
@spec add_new_identity(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  fields :: atom() | [atom()],
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds a new identity unless an identity with that name already exists

Link to this function

add_new_interface(dsl_state, name, opts \\ [])

View Source
@spec add_new_interface(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an interface unless an interface with that name already exists

Link to this function

add_new_relationship(dsl_state, type, name, destination, opts \\ [])

View Source
@spec add_new_relationship(
  Spark.Dsl.Builder.input(),
  type :: Ash.Resource.Relationships.type(),
  name :: atom(),
  destination :: module(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds a new relationship unless a relationship with that name already exists

Link to this function

add_new_update_timestamp(dsl_state, name, opts \\ [])

View Source
@spec add_new_update_timestamp(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  opts :: Keyword.t()
) ::
  Spark.Dsl.Builder.result()

Builds and adds an update_timestamp unless an update_timestamp with that name already exists

Link to this function

add_preparation(dsl_state, ref, opts \\ [])

View Source
@spec add_preparation(
  Spark.Dsl.Builder.input(),
  ref :: module() | {module(), Keyword.t()},
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds a preparation

Link to this function

add_relationship(dsl_state, type, name, destination, opts \\ [])

View Source
@spec add_relationship(
  Spark.Dsl.Builder.input(),
  type :: Ash.Resource.Relationships.type(),
  name :: atom(),
  destination :: module(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an action

Link to this function

add_update_timestamp(dsl_state, name, opts \\ [])

View Source
@spec add_update_timestamp(
  Spark.Dsl.Builder.input(),
  name :: atom(),
  opts :: Keyword.t()
) ::
  Spark.Dsl.Builder.result()

Builds and adds an update_timestamp

Link to this function

build_action(type, name, opts \\ [])

View Source
@spec build_action(
  type :: Ash.Resource.Actions.action_type(),
  name :: atom(),
  opts :: Keyword.t()
) :: {:ok, Ash.Resource.Actions.action()} | {:error, term()}

Builds an action

Link to this function

build_action_argument(name, type, opts \\ [])

View Source
@spec build_action_argument(name :: atom(), type :: Ash.Type.t(), opts :: Keyword.t()) ::
  {:ok, Ash.Resource.Actions.Argument.t()} | {:error, term()}

Builds an action argument

Link to this function

build_action_change(change, opts \\ [])

View Source
@spec build_action_change(change :: Ash.Resource.Change.ref(), opts :: Keyword.t()) ::
  {:ok, Ash.Resource.Change.t()} | {:error, term()}

Builds an action change

Link to this function

build_action_metadata(name, type, opts \\ [])

View Source
@spec build_action_metadata(name :: atom(), type :: Ash.Type.t(), opts :: Keyword.t()) ::
  {:ok, Ash.Resource.Actions.Metadata.t()} | {:error, term()}

Builds an action metadata

Link to this function

build_action_validation(validation, opts \\ [])

View Source
@spec build_action_validation(
  change :: Ash.Resource.Validation.ref(),
  opts :: Keyword.t()
) ::
  {:ok, Ash.Resource.Validation.t()} | {:error, term()}

Builds an action validation

Link to this function

build_aggregate(name, kind, relationship_path, opts \\ [])

View Source
@spec build_aggregate(
  name :: atom(),
  kind :: Ash.Query.Aggregate.kind(),
  relationship_path :: atom() | [atom()],
  opts :: Keyword.t()
) :: {:ok, Ash.Resource.Aggregate.t()} | {:error, term()}

Builds a calculation with the given name, type, and options

Link to this function

build_attribute(name, type, opts \\ [])

View Source
@spec build_attribute(name :: atom(), type :: Ash.Type.t(), opts :: Keyword.t()) ::
  {:ok, Ash.Resource.Attribute.t()} | {:error, term()}

Builds an attribute with the given name, type, and options

Link to this function

build_calculation(name, type, calculation, opts \\ [])

View Source
@spec build_calculation(
  name :: atom(),
  type :: Ash.Type.t(),
  calculation :: module() | {module(), Keyword.t()},
  opts :: Keyword.t()
) :: {:ok, Ash.Resource.Calculation.t()} | {:error, term()}

Builds a calculation with the given name, type, and options

Link to this function

build_calculation_argument(name, type, opts \\ [])

View Source
@spec build_calculation_argument(
  name :: atom(),
  type :: Ash.Type.t(),
  opts :: Keyword.t()
) ::
  {:ok, Ash.Resource.Calculation.Argument.t()} | {:error, term()}

Builds a calculation argument

Link to this function

build_calculation_interface(name, opts \\ [])

View Source
@spec build_calculation_interface(name :: atom(), opts :: Keyword.t()) ::
  {:ok, Ash.Resource.CalculationInterface.t()} | {:error, term()}

Builds an calculation interface with the given name, type, and options

Link to this function

build_change(ref, opts \\ [])

View Source
@spec build_change(
  ref :: module() | {module(), Keyword.t()},
  opts :: Keyword.t()
) :: {:ok, Ash.Resource.Change.t()} | {:error, term()}

Builds a change

Link to this function

build_create_timestamp(name, opts \\ [])

View Source
@spec build_create_timestamp(name :: atom(), opts :: Keyword.t()) ::
  {:ok, Ash.Resource.Attribute.t()} | {:error, term()}

Builds an create_timestamp with the given name, type, and options

Link to this function

build_identity(name, fields, opts \\ [])

View Source
@spec build_identity(
  name :: atom(),
  fields :: atom() | [atom()],
  opts :: Keyword.t()
) :: {:ok, Ash.Resource.Identity.t()} | {:error, term()}

Builds an action

Link to this function

build_interface(name, opts \\ [])

View Source
@spec build_interface(name :: atom(), opts :: Keyword.t()) ::
  {:ok, Ash.Resource.Interface.t()} | {:error, term()}

Builds an interface with the given name, type, and options

Link to this function

build_pagination(opts \\ [])

View Source
@spec build_pagination(pts :: Keyword.t()) ::
  {:ok, Ash.Resource.Actions.Read.Pagination.t()} | {:error, term()}

Builds a pagination object

Link to this function

build_preparation(ref, opts \\ [])

View Source
@spec build_preparation(
  ref :: module() | {module(), Keyword.t()},
  opts :: Keyword.t()
) :: {:ok, Ash.Resource.Preparation.t()} | {:error, term()}

Builds a preparation

Link to this function

build_relationship(type, name, destination, opts \\ [])

View Source
@spec build_relationship(
  type :: Ash.Resource.Relationships.type(),
  name :: atom(),
  destination :: module(),
  opts :: Keyword.t()
) :: {:ok, Ash.Resource.Relationships.relationship()} | {:error, term()}

Builds a relationship

Link to this function

build_update_timestamp(name, opts \\ [])

View Source
@spec build_update_timestamp(name :: atom(), opts :: Keyword.t()) ::
  {:ok, Ash.Resource.Attribute.t()} | {:error, term()}

Builds an update_timestamp with the given name, type, and options

Link to this function

prepend_action(dsl_state, type, name, opts \\ [])

View Source
@spec prepend_action(
  Spark.Dsl.Builder.input(),
  type :: Ash.Resource.Actions.action_type(),
  name :: atom(),
  opts :: Keyword.t()
) :: Spark.Dsl.Builder.result()

Builds and adds an action to the front of the actions list