Instance Method
withConnection(isolation:_:)
iOS 16.0+
macOS 13.0+
tvOS 16.0+
watchOS 9.0+
Lease a connection for the provided
closure’s lifetime.func withConnection<Result>(isolation: isolated (any Actor)? = #isolation, _ closure: nonisolated(nonsending) (PostgresConnection) async throws -> sending Result) async throws -> sending Result
Parameters
isolationThe actor isolation to use for the connection lease.
closureA closure that uses the passed
PostgresConnection. The closure must not capture the providedPostgresConnection.
Return Value
The closure’s return value.