Ecto.Multi.delete_all
You're seeing just the function
delete_all
, go back to Ecto.Multi module for more information.
Specs
delete_all( t(), name(), Ecto.Queryable.t() | fun(Ecto.Queryable.t()), Keyword.t() ) :: t()
Adds a delete_all operation to the multi.
Accepts the same arguments and options as Ecto.Repo.delete_all/2
does.
Example
queryable = from(p in Post, where: p.id < 5)
Ecto.Multi.new()
|> Ecto.Multi.delete_all(:delete_all, queryable)
|> MyApp.Repo.transaction()
Ecto.Multi.new()
|> Ecto.Multi.run(:post, fn repo, _changes ->
case repo.get(Post, 1) do
nil -> {:error, :not_found}
post -> {:ok, post}
end
end)
|> Ecto.Multi.delete_all(:delete_all, fn %{post: post} ->
# Others validations
from(c in Comment, where: c.post_id == ^post.id)
end)
|> MyApp.Repo.transaction()