#
View Source Ash.Resource.Change behaviour (ash v2.14.2)

The behaviour for an action-specific resource change.

`init/1` is defined automatically by `use Ash.Resource.Change`, but can be implemented if you want to validate/transform any options passed to the module.

The main function is `change/3`. It takes the changeset, any options that were provided when this change was configured on a resource, and the context, which currently only has the actor.

# Link to this section Summary

## Types

context()
ref()
t()

## Callbacks

after_batch( list, t, context )
batch_change(list, t, context)
before_batch(list, t, context)
change(t, t, context)
init(t)

# Link to this section Types

Link to this type

# context()

View Source

    @type context() :: %{
      optional(:actor) => Ash.Resource.record(),
      optional(any()) => any()
    }

Link to this type

# ref()

View Source

    @type ref() :: {module(), Keyword.t()} | module()

Link to this type

# t()

View Source

    @type t() :: %Ash.Resource.Change{
      change: term(),
      description: term(),
      on: term(),
      only_when_valid?: term(),
      where: term()
    }

# Link to this section Callbacks

Link to this callback

# after_batch( list, t, context )

View Source (optional)

    @callback after_batch(
      [{Ash.Changeset.t(), Ash.Resource.record()}],
      Keyword.t(),
      context()
    ) ::
      Enumerable.t(
        {:ok, Ash.Resource.record()}
        | {:error, Ash.Error.t()}
        | Ash.Notifier.Notification.t()
      )

Link to this callback

# batch_change(list, t, context)

View Source (optional)

    @callback batch_change([Ash.Changeset.t()], Keyword.t(), context()) ::
      Enumerable.t(Ash.Changeset.t() | Ash.Notifier.Notification.t())

Link to this callback

# before_batch(list, t, context)

View Source (optional)

    @callback before_batch([Ash.Changeset.t()], Keyword.t(), context()) ::
      Enumerable.t(Ash.Changeset.t() | Ash.Notifier.Notification.t())

Link to this callback

# change(t, t, context)

View Source

    @callback change(Ash.Changeset.t(), Keyword.t(), context()) :: Ash.Changeset.t()

Link to this callback

# init(t)

View Source

    @callback init(Keyword.t()) :: {:ok, Keyword.t()} | {:error, term()}