transaction

open override fun <T> transaction(propagation: TransactionPropagation = TransactionPropagation.REQUIRED, isolation: TransactionIsolationLevel? = null, readOnly: Boolean = false, statementTimeout: Duration? = null, transactionTimeout: Duration? = null, block: OctaviusClient.() -> T): T

Runs block in a transaction, committing when it returns and rolling back when it throws. The receiver offers no commit or rollback of its own.

Every query and execute from this thread while block runs lands on the transaction's session. Work handed to another thread does not: a coroutine on another dispatcher gets a session and a transaction of its own.

Parameters

isolation

null for the server's. Ignored when joining a running transaction, as is readOnly.

statementTimeout

Aborts any single statement running longer than this.

transactionTimeout

Aborts the transaction once it has been open longer than this.