Skip to content

Commit 6157fa9

Browse files
authored
Merge pull request #77 from orlandos-nl/feature/jo-fast-bsondecoder
Implement a simpler but faster BSONDecoder for use by MongoKitten
2 parents e28af5a + 8b54dd0 commit 6157fa9

File tree

9 files changed

+978
-81
lines changed

9 files changed

+978
-81
lines changed

Sources/BSON/Codable/Decoding/BSONDecoder.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ extension BSONDecoderSettings.IntegerDecodingStrategy {
102102
}
103103

104104
/// Decodes the `value` without key to an integer of type `I` using the current strategy
105+
@_specialize(where I == UInt8)
106+
@_specialize(where I == Int8)
107+
@_specialize(where I == UInt16)
108+
@_specialize(where I == Int16)
109+
@_specialize(where I == UInt32)
110+
@_specialize(where I == Int32)
111+
@_specialize(where I == UInt)
112+
@_specialize(where I == Int)
105113
internal func decode(
106114
from decoder: _BSONDecoder,
107115
path: @autoclosure () -> [String]

Sources/BSON/Codable/Decoding/BSONDecoderSettings.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ public struct BSONDecoderSettings {
158158
/// If `true`, allows decoding ObjectIds from Strings if they're formatted as a 24-character hexString
159159
public var decodeObjectIdFromString: Bool = false
160160

161-
/// If `true`, allows decoding ObjectIds from Strings if they're formatted as a 24-character hexString
162-
public var decodeDateFromTimestamp: Bool = false
161+
/// If `true`, allows decoding Date from a Double (TimeInterval)
162+
public var decodeDateFromTimestamp: Bool = true
163163

164164
/// A strategy that is applied when encountering a request to decode a `Float`
165165
public var floatDecodingStrategy: FloatDecodingStrategy

0 commit comments

Comments
 (0)