Binary

public struct Binary : BSONValue, Equatable, Codable

A struct to represent the BSON Binary type.

  • Declaration

    Swift

    public var bsonType: BSONType { get }
  • The binary data.

    Declaration

    Swift

    public let data: Data
  • The binary subtype for this data.

    Declaration

    Swift

    public let subtype: UInt8
  • Subtypes for BSON Binary values.

    See more

    Declaration

    Swift

    public enum Subtype : UInt8
  • Initializes a Binary instance from a UUID.

    Throws

    • UserError.invalidArgumentError if a Binary cannot be constructed from this UUID.

    Declaration

    Swift

    public init(from uuid: UUID) throws
  • Initializes a Binary instance from a Data object and a UInt8 subtype.

    Throws

    • UserError.invalidArgumentError if the provided data is incompatible with the specified subtype.

    Declaration

    Swift

    public init(data: Data, subtype: UInt8) throws
  • Initializes a Binary instance from a Data object and a Subtype.

    Throws

    • UserError.invalidArgumentError if the provided data is incompatible with the specified subtype.

    Declaration

    Swift

    public init(data: Data, subtype: Subtype) throws
  • Initializes a Binary instance from a base64 String and a UInt8 subtype.

    Throws

    • UserError.invalidArgumentError if the base64 String is invalid or if the provided data is incompatible with the specified subtype.

    Declaration

    Swift

    public init(base64: String, subtype: UInt8) throws
  • Initializes a Binary instance from a base64 String and a Subtype.

    Throws

    • UserError.invalidArgumentError if the base64 String is invalid or if the provided data is incompatible with the specified subtype.

    Declaration

    Swift

    public init(base64: String, subtype: Subtype) throws
  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Declaration

    Swift

    public func encode(to: Encoder) throws
  • Declaration

    Swift

    public func encode(to storage: DocumentStorage, forKey key: String) throws
  • Declaration

    Swift

    public static func from(iterator iter: DocumentIterator) throws -> Binary