← Back to Stormify Documentation

transaction

suspend fun <R> transaction(block: suspend TransactionContext.() -> R): R

Execute block inside a transaction. Commits on success, rolls back on any throwable.

If called from inside another transaction { } on the same Stormify instance (detected via the current ConnectionElement), reuses that connection via a savepoint rather than acquiring a new one.