Row

public struct Row : Hashable, Sequence

A single entry in a Relation. Conceptually, the same as Dictionary<Attribute, RelationValue>. The implementation is more complex, and optimized for the use cases it sees in this code. In particular, the underlying storage is implemented as an interned object, which makes hashing and equality really quick to evaluate.

  • Initialize a new Row from a sequence of Attribute/RelationValue pairs.

    Declaration

    Swift

    public init<S>(values: S) where S : Sequence, S.Element == (key: Attribute, value: RelationValue)
  • A convenience for a row with no attributes or values.

    Declaration

    Swift

    public static var empty: Row
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Retrieve the value for a given Attribute. If the Row does not contain the Attribute, return .notFound.

    Declaration

    Swift

    public subscript(attribute: Attribute) -> RelationValue { get set }
  • Return a new Row created by renaming each key in renames to the corresponding value.

    Declaration

    Swift

    public func renameAttributes(_ renames: [Attribute : Attribute]) -> Row
  • Create a new row containing only the values whose attributes are also in the attributes parameter.

    Declaration

    Swift

    public func rowWithAttributes<Seq>(_ attributes: Seq) -> Row where Seq : Sequence, Seq.Element == Attribute
  • Create a new row containing only the values whose attributes are also in the attributes parameter.

    Declaration

    Swift

    public func rowWithAttributes(_ attributes: Set<Attribute>) -> Row
  • Produce a new Row by applying updated values to this Row. Any attributes that exist in newValues but not self will be added. Any attributes that exist in both will be set to the new value. Attributes only in self are left alone.

    Declaration

    Swift

    public func rowWithUpdate(_ newValues: Row) -> Row
  • Declaration

    Swift

    public struct Iterator : IteratorProtocol
  • Declaration

    Swift

    public func makeIterator() -> Iterator
  • The attributes in the Row.

    Declaration

    Swift

    public var attributes: LazyMapSequence<Row, Attribute> { get }
  • The Row‘s scheme.

    Declaration

    Swift

    public var scheme: Scheme { get }
  • The number of values in the Row.

    Declaration

    Swift

    public var count: Int { get }
  • Whether the Row is empty.

    Declaration

    Swift

    public var isEmpty: Bool { get }
  • Declaration

    Swift

    public var description: String { get }
  • Undocumented

    Declaration

    Swift

    public static func fromPlist(_ plist: Any) -> Result<Row, RelationError>
  • Undocumented

    Declaration

    Swift

    public func toPlist() -> Any