Instance Method
withConnection(_:)
Call the provided closure with a concrete
SQLiteConnection instance.@preconcurrency func withConnection<T>(_ closure: @escaping @Sendable (SQLiteConnection) -> EventLoopFuture<T>) -> EventLoopFuture<T>
Parameters
closureThe closure to invoke. Unless the closure changes the connection’s state itself or the connection is closed by SQLite due to error, it is guaranteed to remain valid until the future returned by the closure is completed or failed.
Return Value
A future signaling completion of the closure and containing the closure’s result, if any.
Discussion
This method is required to provide a connection object which executes all queries directed to it in the same “session” (e.g. always on the same connection, such as without rotating through a pool).