Ecto.Multi.run

You're seeing just the function run, go back to Ecto.Multi module for more information.

Specs

run(t(), name(), run()) :: t()

Adds a function to run as part of the multi.

The function should return either {:ok, value} or {:error, value}, and receives the repo as the first argument, and the changes so far as the second argument.

Example

Ecto.Multi.run(multi, :write, fn _repo, %{image: image} ->
  with :ok <- File.write(image.name, image.contents) do
    {:ok, nil}
  end
end)
Link to this function

run(multi, name, mod, fun, args)

View Source

Specs

run(t(), name(), module(), function, args) :: t()
when function: atom(), args: [any()]

Adds a function to run as part of the multi.

Similar to run/3, but allows to pass module name, function and arguments. The function should return either {:ok, value} or {:error, value}, and receives the repo as the first argument, and the changes so far as the second argument (prepended to those passed in the call to the function).