Skip to content

Instance Method

query(_:logger:file:line:_:)

Run a query on the Postgres server the connection is connected to and iterate the rows in a callback.
@preconcurrency func query(_ query: PostgresQuery, logger: Logger, file: String = #fileID, line: Int = #line, _ onRow: @escaping @Sendable (PostgresRow) throws -> ()) -> EventLoopFuture<PostgresQueryMetadata>

Parameters

query

The PostgresQuery to run

logger

The Logger to log into for the query

file

The file the query was started in. Used for better error reporting.

line

The line the query was started in. Used for better error reporting.

onRow

A closure that is invoked for every row.

Return Value

An EventLoopFuture, that allows access to the future PostgresQueryMetadata.

Discussion

Note

This API does not support back-pressure. If you need back-pressure please use the query API, that supports structured concurrency.