Ecto.Multi.run
You're seeing just the function
run
, go back to Ecto.Multi module for more information.
Specs
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)
Specs
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).