openSession

fun openSession(beforePrimaryConnectionAccess: () -> Unit, onTransactionStateChanged: (Boolean) -> Unit): SQLDatabaseSession(source)

Opens an explicitly owned session with callbacks for coordinating its lifecycle with an external owner. The returned session is not thread-safe and must be closed when no longer needed.

Parameters

beforePrimaryConnectionAccess

invoked before waiting for the primary connection.

onTransactionStateChanged

invoked at successful transaction begin and at every subsequent end.