DoubleDown.Repo.Impl.MultiStepper (double_down v0.48.1)

Copy Markdown View Source

Steps through an Ecto.Multi without a real database transaction.

Used by DoubleDown.Repo.Stub and DoubleDown.Repo.OpenInMemory to execute Multi operations in order, accumulating a changes map.

The repo_facade argument is passed to :run callbacks as the first argument (the "repo"), mirroring how Ecto passes the Repo module to Ecto.Multi.run/3 callbacks.

Return values

  • {:ok, changes} — all operations succeeded
  • {:error, name, value, changes_so_far} — an operation failed

Summary

Functions

Execute all operations in the given Ecto.Multi.

Types

changes()

@type changes() :: %{optional(any()) => any()}

Functions

run(multi, repo_facade)

@spec run(Ecto.Multi.t(), module()) ::
  {:ok, changes()} | {:error, any(), any(), changes()}

Execute all operations in the given Ecto.Multi.

repo_facade is the module passed to :run callbacks as the repo argument — typically the Repo facade module so callbacks can call repo.insert/1, repo.get/2, etc.