Instance Method
withAuthorizerObserver(_:body:)
Execute a block with a temporary authorizer observer.
func withAuthorizerObserver<T>(_ callback: @escaping SQLiteConnection.SQLiteAuthorizerObserver, body: () async throws -> T) async throws -> T
Parameters
callbackThe observer callback to register temporarily.
bodyThe 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. Authorizer observers perform pure observation without influencing access control.
let result = try await connection.withAuthorizerObserver({ event in
print("Database access: \(event.action)")
}) {
// perform async operations - observer is active
return await someAsyncComputation()
}
// observer is automatically removed here
Throws
Any error thrown by the body block.