AshGleam.Changeset (ash_gleam v0.3.1)

Copy Markdown

Builds an Ash.Changeset from a Gleam update-style action without persisting.

Summary

Functions

Runs a Gleam action marked update? true and returns an Ash.Changeset ready for persistence.

Functions

for_update(record, gleam_action_name, params \\ %{}, opts)

@spec for_update(struct(), atom(), map(), Keyword.t()) ::
  {:ok, Ash.Changeset.t()} | {:error, term()}

Runs a Gleam action marked update? true and returns an Ash.Changeset ready for persistence.

Options

  • :action (required) - the Ash update action to build the changeset with

Example

todo
|> AshGleam.Changeset.for_update(:mark_completed, %{}, action: :update)
|> Ash.update!()