AnyBSON
@frozen
public enum AnyBSON : BSON, Sendable
extension AnyBSON: ExpressibleByStringLiteral
extension AnyBSON: ExpressibleByBooleanLiteral
extension AnyBSON: ExpressibleByFloatLiteral
extension AnyBSON: ExpressibleByIntegerLiteral
extension AnyBSON: ExpressibleByDictionaryLiteral
extension AnyBSON: ExpressibleByArrayLiteral
extension AnyBSON: Equatable
extension AnyBSON: Hashable
Enum representing a BSON value.
See also
bsonspec.org-
A BSON double.
Declaration
Swift
case double(Double) -
A BSON string.
Declaration
Swift
case string(String) -
A BSON document.
Declaration
Swift
indirect case document(Document) -
A BSON array.
Declaration
Swift
indirect case array([AnyBSON?]) -
A BSON binary.
Declaration
Swift
case binary(Data) -
A BSON ObjectId.
Declaration
Swift
case objectId(ObjectId) -
A BSON boolean.
Declaration
Swift
case bool(Bool) -
A BSON UTC datetime.
Declaration
Swift
case datetime(Date) -
A BSON regular expression.
Declaration
Swift
case regex(NSRegularExpression) -
A BSON int32.
Declaration
Swift
case int32(Int32) -
A BSON timestamp.
Declaration
Swift
case timestamp(Date) -
A BSON int64.
Declaration
Swift
case int64(Int64) -
A BSON Decimal128.
Declaration
Swift
case decimal128(Decimal128) -
A UUID.
Declaration
Swift
case uuid(UUID) -
A BSON minKey.
Declaration
Swift
case minKey -
A BSON maxKey.
Declaration
Swift
case maxKey -
A BSON null type.
Declaration
Swift
case null -
Initialize a
BSONfrom an integer. On 64-bit systems, this will result in an.int64. On 32-bit systems, this will result in an.int32.Declaration
Swift
public init(_ int: Int) -
If this
BSONis an.int32, return it as anInt32. Otherwise, return nil.Declaration
Swift
public var int32Value: Int32? { get } -
If this
BSONis a.regex, return it as aRegularExpression. Otherwise, return nil.Declaration
Swift
public var regexValue: NSRegularExpression? { get } -
If this
BSONis an.int64, return it as anInt64. Otherwise, return nil.Declaration
Swift
public var int64Value: Int64? { get } -
Declaration
Swift
public var objectIdValue: ObjectId? { get } -
If this
BSONis a.date, return it as aDate. Otherwise, return nil.Declaration
Swift
public var dateValue: Date? { get } -
If this
BSONis an.array, return it as an[BSON]. Otherwise, return nil.Declaration
Swift
public var arrayValue: [AnyBSON?]? { get } -
If this
BSONis a.string, return it as aString. Otherwise, return nil.Declaration
Swift
public var stringValue: String? { get } -
Declaration
Swift
public var documentValue: Document? { get } -
If this
BSONis a.bool, return it as anBool. Otherwise, return nil.Declaration
Swift
public var boolValue: Bool? { get } -
If this
BSONis a.binary, return it as aBinary. Otherwise, return nil.Declaration
Swift
public var binaryValue: Data? { get } -
If this
BSONis a.double, return it as aDouble. Otherwise, return nil.Declaration
Swift
public var doubleValue: Double? { get } -
If this
BSONis a.decimal128, return it as aDecimal128. Otherwise, return nil.Declaration
Swift
public var decimal128Value: Decimal128? { get } -
If this
BSONis a.timestamp, return it as aTimestamp. Otherwise, return nil.Declaration
Swift
public var timestampValue: Date? { get } -
If this
BSONis a.uuid, return it as aUUID. Otherwise, return nil.Declaration
Swift
public var uuidValue: UUID? { get } -
Declaration
Swift
public var isNull: Bool { get } -
Return this BSON as an
Intif possible. This will coerce non-integer numeric cases (e.g..double) into anIntif such coercion would be lossless.Declaration
Swift
public func asInt() -> Int? -
Return this BSON as an
Int32if possible. This will coerce numeric cases (e.g..double) into anInt32if such coercion would be lossless.Declaration
Swift
public func asInt32() -> Int32? -
Return this BSON as an
Int64if possible. This will coerce numeric cases (e.g..double) into anInt64if such coercion would be lossless.Declaration
Swift
public func asInt64() -> Int64? -
Return this BSON as a
Doubleif possible. This will coerce numeric cases (e.g..decimal128) into aDoubleif such coercion would be lossless.Declaration
Swift
public func asDouble() -> Double? -
Return this BSON as a
Decimal128if possible. This will coerce numeric cases (e.g..double) into aDecimal128if such coercion would be lossless.Declaration
Swift
public func asDecimal128() -> Decimal128? -
Return this BSON as a
Tif possible, otherwise nil.Declaration
Swift
public func value<T>() -> T? where T : BSON -
Declaration
Swift
public init(stringLiteral value: String) -
Declaration
Swift
public init(booleanLiteral value: Bool) -
Declaration
Swift
public init(floatLiteral value: Double) -
Initialize a
BSONfrom an integer. On 64-bit systems, this will result in an.int64. On 32-bit systems, this will result in an.int32.Declaration
Swift
public init(integerLiteral value: Int) -
Declaration
Swift
public init(dictionaryLiteral elements: (String, AnyBSON?)...) -
Declaration
Swift
public init(arrayLiteral elements: AnyBSON?...)
View on GitHub
Install in Dash