Instance Method
first()
Returns the first output row, if any.
func first() async throws -> Optional<any SQLRow>
Return Value
The first output row, if any.
Discussion
If self conforms to SQLPartialResultBuilder, limit(_:) is used to avoid loading more rows than necessary from the database.
Note
This method returns Optional<any SQLRow> rather than the semantically identical (any SQLRow)? due to a bug in Swift DocC causing it to become confused by the latter. The syntactic sugar will be restored once the bug is fixed.
See Also
Getting One Row
func first<D>(decoding: D.Type) async throws -> D?Using a default-configuredSQLRowDecoder, returns the first output row, if any, decoded as a given type.func first<D>(decoding: D.Type, prefix: String?, keyDecodingStrategy: SQLRowDecoder.KeyDecodingStrategy, userInfo: [CodingUserInfoKey : any Sendable]) async throws -> D?Configure a newSQLRowDecoderas specified and use it to decode and return the first output row, if any, as a given type.func first<D>(decoding: D.Type, with: SQLRowDecoder) async throws -> D?Using the givenSQLRowDecoder, returns the first output row, if any, decoded as a given type.func first<D>(decodingColumn: String, as: D.Type) async throws -> D?Returns the named column from the first output row, if any, decoded as a given type.