BSONBinary
public struct BSONBinary : Equatable, Hashable
A struct to represent the BSON Binary type.
-
The binary data.
Declaration
Swift
public let data: ByteBuffer
-
The binary subtype for this data.
Declaration
Swift
public let subtype: Subtype
-
Subtypes for BSON Binary values.
See moreDeclaration
Swift
public struct Subtype : Equatable, Hashable, RawRepresentable, Codable
-
Initializes a
BSONBinary
instance from aUUID
.Throws
BSONError.InvalidArgumentError
if aBSONBinary
cannot be constructed from this UUID.
Declaration
Swift
public init(from uuid: UUID) throws
-
Initializes a
BSONBinary
instance from aData
object and aSubtype
subtype. This will always create a copy of the data.Throws
BSONError.InvalidArgumentError
if the provided data is incompatible with the specified subtype.
Declaration
Swift
public init(data: Data, subtype: Subtype) throws
-
Initializes a
BSONBinary
instance from a base64String
and aSubtype
.Throws
BSONError.InvalidArgumentError
if the base64String
is invalid or if the provided data is incompatible with the specified subtype.
Declaration
Swift
public init(base64: String, subtype: Subtype) throws
-
Converts this
BSONBinary
instance to aUUID
.Throws
BSONError.InvalidArgumentError
if a non-UUID subtype is set on thisBSONBinary
.
Declaration
Swift
public func toUUID() throws -> UUID