DatabaseValue

public struct DatabaseValue : Equatable, Hashable, Comparable, ExpressibleByStringLiteral

This type describes a key or value in the database.

It provides a thin wrapper around the raw sequence of bytes.

  • The raw data that is stored in the database.

    Declaration

    Swift

    public var data: Data
  • This initializer creates an empty tuple.

    Declaration

    Swift

    public init()
  • This initializer creates a tuple from raw data from the database.

    This is only intended to be used internally when deserializing data.

    Declaration

    Swift

    public init(_ rawData: Data)
  • Undocumented

    Declaration

    Swift

    public init(bytes: [UInt8])
  • This initializer creates a tuple holding a string.

    Declaration

    Swift

    public init(string: String)

    Parameters

    string

    The string to put in the tuple.

  • This initializer creates a tuple holding a string.

    Declaration

    Swift

    public init(stringLiteral string: String)

    Parameters

    string

    The string to put in the tuple.

  • This initializer creates a tuple holding a string.

    Declaration

    Swift

    public init(extendedGraphemeClusterLiteral string: String)

    Parameters

    string

    The string to put in the tuple.

  • This initializer creates a tuple holding a string.

    Declaration

    Swift

    public init(unicodeScalarLiteral string: String)

    Parameters

    string

    The string to put in the tuple.

  • This method determines if this tuple has another as a prefix.

    This is true whenever the raw data for this tuple begins with the same bytes as the raw data for the other tuple.

    Declaration

    Swift

    public func hasPrefix(_ prefix: DatabaseValue) -> Bool

    Parameters

    prefix

    The tuple we are checking as a possible prefix.

    Return Value

    Whether this tuple has the other tuple as its prefix.

  • This method gets the hash code for this tuple.

    Declaration

    Swift

    public var hashValue: Int { get }
  • This method increments the last byte in this data.

    If the last byte is 0xFF, this will wrap it around to 0x00 and increment the prior byte.

    Declaration

    Swift

    public mutating func increment()