TransactionScope
-
Cmn
interface TransactionScope<T : Any?> : PooledConnection
A PooledConnection with an active transaction capable of performing nested transactions.
| See also | |
|---|---|
Transactor |
Summary
Public functions |
||
|---|---|---|
suspend Nothing |
rollback(result: T)Rollback the transaction, completing it and returning the |
Cmn
|
suspend R |
<R : Any?> withNestedTransaction(block: suspend TransactionScope<R>.() -> R)Begins a nested transaction and runs the |
Cmn
|
Inherited functions |
|||
|---|---|---|---|
|
Public functions
rollback
suspend fun rollback(result: T): Nothing
Rollback the transaction, completing it and returning the result.
| See also | |
|---|---|
withTransaction |
|
withNestedTransaction |
withNestedTransaction
suspend fun <R : Any?> withNestedTransaction(block: suspend TransactionScope<R>.() -> R): R
Begins a nested transaction and runs the block within the transaction. If block fails to complete normally i.e., an exception is thrown, or rollback is invoked then the transaction will be rollback, otherwise it is committed.
Note that a nested transaction is still governed by its parent transaction and it too must complete successfully for all its children transactions to be committed.
See also Savepoint
| Parameters | |
|---|---|
block: suspend TransactionScope<R>.() -> R |
The code that will execute within the transaction. |