TupleResultSet

public struct TupleResultSet : Equatable

This type describes the results of a reading a range of keys from the database.

  • The keys and values that we read.

    Declaration

    Swift

    public let rows: [(key: Tuple, value: Tuple)]
  • Undocumented

    Declaration

    Swift

    public init(_ resultSet: ResultSet)
  • Undocumented

    Declaration

    Swift

    public init(rows: [(key: Tuple, value: Tuple)])
  • This type provides errors that can be thrown when reading fields from a tuple in a result set.

    These wrap around the errors in Tuple.ParsingError to replace the index with the database key, which is more useful when reading fields from a result set.

    See more

    Declaration

    Swift

    public enum ParsingError : Error
  • This method reads a key from the result set.

    This will automatically convert it into the requested return type. If it cannot be converted into the requested return type, it will rethrow the resulting error.

    If the value is missing, this will throw Tuple.ParsingError.MissingKey.

    Throws

    Tuple.ParsingError.

    Declaration

    Swift

    public func read<ReturnType>(_ key: Tuple) throws -> ReturnType where ReturnType : TupleConvertible

    Parameters

    key

    The key to fetch.

    Return Value

    The converted value.

  • This method reads a key from the result set.

    If the value is missing, this will throw Tuple.ParsingError.MissingKey.

    Throws

    Tuple.ParsingError.

    Declaration

    Swift

    public func read(_ key: Tuple) throws -> Tuple

    Parameters

    key

    The key to fetch.

    Return Value

    The converted value.

  • This method reads a key from the result set.

    This will automatically convert it into the requested return type. If it cannot be converted into the requested return type, it will rethrow the resulting error.

    If the value is missing, this will return nil.

    Throws

    Tuple.ParsingError.

    Declaration

    Swift

    public func read<ReturnType>(_ key: Tuple) throws -> ReturnType? where ReturnType : TupleConvertible

    Parameters

    key

    The key to fetch.

    Return Value

    The converted value.