BSON
public enum BSON
extension BSON: ExpressibleByIntegerLiteral
extension BSON: ExpressibleByFloatLiteral
extension BSON: ExpressibleByBooleanLiteral
extension BSON: ExpressibleByDictionaryLiteral
extension BSON: ExpressibleByStringLiteral
extension BSON: ExpressibleByArrayLiteral
extension BSON: Equatable
extension BSON: Hashable
extension BSON: Codable
Enum representing a BSON value.
See also
bsonspec.org-
A BSON document.
Declaration
Swift
case document(BSONDocument) -
A BSON int32.
Declaration
Swift
case int32(Int32) -
A BSON int64.
Declaration
Swift
case int64(Int64) -
A BSON Decimal128
Declaration
Swift
case decimal128(BSONDecimal128) -
A BSON Array
Declaration
Swift
indirect case array([BSON]) -
A BSON Boolean
Declaration
Swift
case bool(Bool) -
A BSON UTC datetime. When serialized to actual BSON bytes, the
Datemust be representable by a 64-bit signed integer of milliseconds since the epoch. If theDatecannot be represented in that manner (i.e. it is too far in the future or too far in the past), it will be serialized as either the minimum or maximum possibleDate, whichever is closer.Declaration
Swift
case datetime(Date) -
A BSON double.
Declaration
Swift
case double(Double) -
A BSON string.
Declaration
Swift
case string(String) -
A BSON Symbol
Declaration
Swift
case symbol(BSONSymbol) -
A BSON Timestamp
Declaration
Swift
case timestamp(BSONTimestamp) -
A BSON Binary
Declaration
Swift
case binary(BSONBinary) -
A BSON Regex
Declaration
Swift
case regex(BSONRegularExpression) -
A BSON ObjectID
Declaration
Swift
case objectID(_: BSONObjectID = BSONObjectID()) -
A BSON DBPointer
Declaration
Swift
case dbPointer(BSONDBPointer) -
A BSON Code
Declaration
Swift
case code(BSONCode) -
A BSON Code with Scope
Declaration
Swift
case codeWithScope(BSONCodeWithScope) -
A BSON Null
Declaration
Swift
case null -
A BSON Undefined
Declaration
Swift
case undefined -
A BSON MinKey
Declaration
Swift
case minKey -
A BSON MaxKey
Declaration
Swift
case maxKey -
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 an.int64, return it as anInt64. Otherwise, return nil.Declaration
Swift
public var int64Value: Int64? { get } -
If this
BSONis an.decimal128, return it as anBSONDecimal128. Otherwise, return nil.Declaration
Swift
public var decimal128Value: BSONDecimal128? { get } -
If this
BSONis a.document, return it as aBSONDocument. Otherwise, return nil.Declaration
Swift
public var documentValue: BSONDocument? { get } -
If this
BSONis a.array, return it as a[BSON]. Otherwise, return nil.Declaration
Swift
public var arrayValue: [BSON]? { get } -
If this
BSONis a.bool, return it as aBool. Otherwise, return nil.Declaration
Swift
public var boolValue: Bool? { get } -
If this
BSONis a.date, return it as aDate. Otherwise, return nil.Declaration
Swift
public var dateValue: Date? { get } -
If this
BSONis a.double, return it as aDouble. Otherwise, return nil.Declaration
Swift
public var doubleValue: Double? { get } -
If this
BSONis a.string, return it as aString. Otherwise, return nil.Declaration
Swift
public var stringValue: String? { get } -
If this
BSONis a.symbol, return it as aBSONSymbol. Otherwise, return nil.Declaration
Swift
public var symbolValue: BSONSymbol? { get } -
If this
BSONis a.timestamp, return it as aBSONTimestamp. Otherwise, return nil.Declaration
Swift
public var timestampValue: BSONTimestamp? { get } -
If this
BSONis a.binary, return it as aBSONBinary. Otherwise, return nil.Declaration
Swift
public var binaryValue: BSONBinary? { get } -
If this
BSONis a.regex, return it as aBSONRegularExpression. Otherwise, return nil.Declaration
Swift
public var regexValue: BSONRegularExpression? { get } -
If this
BSONis a.objectID, return it as aBSONObjectID. Otherwise, return nil.Declaration
Swift
public var objectIDValue: BSONObjectID? { get } -
If this
BSONis a.dbPointer, return it as aBSONDBPointer. Otherwise, return nil.Declaration
Swift
public var dbPointerValue: BSONDBPointer? { get } -
If this
BSONis a.codeWithScope, return it as aBSONCodeWithScope. Otherwise, return nil.Declaration
Swift
public var codeWithScopeValue: BSONCodeWithScope? { 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 toInt() -> 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 toInt32() -> 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 toInt64() -> Int64? -
Return this BSON as a
Doubleif possible. This will coerce numeric cases (e.g..int32) into aDoubleif such coercion would be lossless.Declaration
Swift
public func toDouble() -> Double? -
Return this BSON as a
BSONDecimal128if possible. This will coerce numeric cases (e.g..double) into aBSONDecimal128if such coercion would be lossless.Declaration
Swift
public func toDecimal128() -> BSONDecimal128? -
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(floatLiteral value: Double) -
Declaration
Swift
public init(booleanLiteral value: Bool) -
Declaration
Swift
public init(dictionaryLiteral elements: (String, BSON)...) -
Declaration
Swift
public init(stringLiteral value: String) -
Declaration
Swift
public init(arrayLiteral elements: BSON...) -
Declaration
Swift
public init(from decoder: Decoder) throws -
Declaration
Swift
public func encode(to encoder: Encoder) throws
View on GitHub
Install in Dash
BSON Enumeration Reference