BSONNumber
public protocol BSONNumber : BSONValue
A protocol that numeric BSONValue
s should conform to. It provides functionality for converting to BSON’s native
number types.
-
intValue
Default implementationCreate an
Int
from thisBSONNumber
. This will return nil if the conversion cannot result in an exact representation.Default Implementation
Create an
Int
from thisBinaryFloatingPoint
. This will return nil if the conversion cannot result in an exact representation.Declaration
Swift
var intValue: Int? { get }
-
int32Value
Default implementationCreate an
Int32
from thisBSONNumber
. This will return nil if the conversion cannot result in an exact representation.Default Implementation
Create an
Int32
from thisBinaryFloatingPoint
. This will return nil if the conversion cannot result in an exact representation.Declaration
Swift
var int32Value: Int32? { get }
-
int64Value
Default implementationCreate an
Int64
from thisBSONNumber
. This will return nil if the conversion cannot result in an exact representation.Default Implementation
Create an
Int64
from thisBinaryFloatingPoint
. This will return nil if the conversion cannot result in an exact representation.Declaration
Swift
var int64Value: Int64? { get }
-
doubleValue
Default implementationCreate a
Double
from thisBSONNumber
. This will return nil if the conversion cannot result in an exact representation.Default Implementation
Create a
Double
from thisBinaryFloatingPoint
. This will return nil if the conversion cannot result in an exact representation.Declaration
Swift
var doubleValue: Double? { get }
-
decimal128Value
Default implementationCreate a
Decimal128
from thisBSONNumber
. This will return nil if the conversion cannot result in an exact representation.Default Implementation
Create a
Decimal128
from thisNumeric
. This will return nil if the conversion cannot result in an exact representation.Declaration
Swift
var decimal128Value: Decimal128? { get }