Ecto.Multi.insert_or_update

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

insert_or_update(multi, name, changeset_or_fun, opts \\ [])

View Source

Specs

insert_or_update(
  t(),
  name(),
  Ecto.Changeset.t() | fun(Ecto.Changeset.t()),
  Keyword.t()
) :: t()

Inserts or updates a changeset depending on whether the changeset was persisted or not.

Accepts the same arguments and options as Ecto.Repo.insert_or_update/2 does.

Example

changeset = Post.changeset(%Post{}, %{title: "New title"})
Ecto.Multi.new()
|> Ecto.Multi.insert_or_update(:insert_or_update, changeset)
|> MyApp.Repo.transaction()

Ecto.Multi.new()
|> Ecto.Multi.run(:post, fn repo, _changes ->
     {:ok, repo.get(Post, 1) || %Post{}}
   end)
|> Ecto.Multi.insert_or_update(:update, fn %{post: post} ->
     Ecto.Changeset.change(post, title: "New title")
   end)
|> MyApp.Repo.transaction()