Skip to content

Instance Method

withCommitObserver(_:body:)

Execute a block with a temporary commit observer.
func withCommitObserver<T>(_ callback: @escaping SQLiteConnection.SQLiteCommitObserver, body: () async throws -> T) async throws -> T

Parameters

callback

The observer callback to register temporarily.

body

The block to execute with the observer active.

Return Value

The return value of the body block.

Discussion

The observer is automatically removed when the block completes. Observers cannot veto commits - they are for logging and metrics only.

Throws

Any error thrown by the body block.