# `Ecto.Adapter.Transaction`
[🔗](https://github.com/elixir-ecto/ecto/blob/v3.13.6/lib/ecto/adapter/transaction.ex#L1)

Specifies the adapter transactions API.

# `adapter_meta`

```elixir
@type adapter_meta() :: Ecto.Adapter.adapter_meta()
```

# `in_transaction?`

```elixir
@callback in_transaction?(adapter_meta()) :: boolean()
```

Returns true if the given process is inside a transaction.

# `rollback`

```elixir
@callback rollback(adapter_meta(), value :: any()) :: no_return()
```

Rolls back the current transaction.

The transaction will return the value given as `{:error, value}`.

See `c:Ecto.Repo.rollback/1`.

# `transaction`

```elixir
@callback transaction(adapter_meta(), options :: Keyword.t(), function :: fun()) ::
  {:ok, any()} | {:error, any()}
```

Runs the given function inside a transaction.

Returns `{:ok, value}` if the transaction was successful where `value`
is the value returned by the function or `{:error, value}` if the transaction
was rolled back where `value` is the value given to `rollback/1`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
