Session transactions. transaction/3 begins a session, runs the fun with a
session-scoped conn, and commits on a normal return. On an exception it rolls
back and RERAISES (postgrex semantics — unexpected failures propagate, they do
not become {:error, …}). Use rollback/2 for an intentional abort that yields
{:error, reason}. Nesting raises — there is no verified HTTP savepoint contract.
Summary
Functions
Begin a session; returns a session-scoped conn.
Commit a session-scoped conn.
Roll back a session-scoped conn.
Abort the current transaction with reason; the enclosing transaction/3 returns {:error, reason}.
Run fun inside a session transaction. Opts: :isolation (:read_committed | :repeatable_read).
Functions
@spec begin( Arcadic.Conn.t(), keyword() ) :: {:ok, Arcadic.Conn.t()} | {:error, Arcadic.Error.t() | Arcadic.TransportError.t()}
Begin a session; returns a session-scoped conn.
@spec commit(Arcadic.Conn.t()) :: :ok | {:error, Arcadic.Error.t() | Arcadic.TransportError.t()}
Commit a session-scoped conn.
@spec rollback(Arcadic.Conn.t()) :: :ok | {:error, Arcadic.Error.t() | Arcadic.TransportError.t()}
Roll back a session-scoped conn.
@spec rollback(Arcadic.Conn.t(), term()) :: no_return()
Abort the current transaction with reason; the enclosing transaction/3 returns {:error, reason}.
@spec transaction(Arcadic.Conn.t(), (Arcadic.Conn.t() -> result), keyword()) :: {:ok, result} | {:error, Arcadic.Error.t() | Arcadic.TransportError.t() | term()} when result: var
Run fun inside a session transaction. Opts: :isolation (:read_committed | :repeatable_read).