SqkonTransactionScope

sealed interface SqkonTransactionScope(source)

Sqkon-owned transaction scope, the receiver of transaction / transactionWithResult.

Replaces direct exposure of SQLDelight's Transacter / TransactionCallbacks. sealed — only Sqkon provides implementations; callers must not implement it.

Functions

Link copied to clipboard
abstract fun afterCommit(action: () -> Unit)

Run action after the outermost enclosing transaction commits.

Link copied to clipboard
abstract fun afterRollback(action: () -> Unit)

Run action after the transaction rolls back.

Link copied to clipboard
abstract fun rollback(): Nothing

Abort the transaction by throwing SqkonRollbackException, rolling back the database transaction (and any enclosing one — there are no savepoints).

Link copied to clipboard
abstract fun transaction(body: SqkonTransactionScope.() -> Unit)

Run body in a nested transaction. A nested rollback rolls back the enclosing transaction too (no savepoint semantics).