newSuspendedTransaction

suspend fun <T> newSuspendedTransaction(context: CoroutineContext? = null, db: Database? = null, transactionIsolation: Int? = null, statement: suspend Transaction.() -> T): T

Creates a new TransactionScope then calls the specified suspending statement, suspends until it completes, and returns the result.

The TransactionScope is derived from a new Transaction and a given coroutine context, or the current CoroutineContext if no context is provided.

Samples

org.jetbrains.exposed.sql.tests.shared.CoroutineTests.suspendedTx