Ecto v2.2.7 Ecto.Adapter.Transaction behaviour View Source
Specifies the adapter transactions API.
Link to this section Summary
Callbacks
Returns true if the given process is inside a transaction
Rolls back the current transaction
Runs the given function inside a transaction
Link to this section Callbacks
Link to this callback
in_transaction?(repo)
View Source
in_transaction?(repo :: Ecto.Repo.t()) :: boolean()
Returns true if the given process is inside a transaction.
Link to this callback
rollback(repo, value)
View Source
rollback(repo :: Ecto.Repo.t(), value :: any()) :: no_return()
Rolls back the current transaction.
The transaction will return the value given as {:error, value}
.
See Ecto.Repo.rollback/1
.
Link to this callback
transaction(repo, options, function)
View Source
transaction(repo :: Ecto.Repo.t(), options :: Keyword.t(), function :: (... -> any())) :: {:ok, any()} | {:error, any()}
Runs the given function inside a transaction.
Returns {:ok, value}
if the transaction was successful where value
is the value return by the function or {:error, value}
if the transaction
was rolled back where value
is the value given to rollback/1
.
See Ecto.Repo.transaction/1
.