From 889a1a65c08c62dcca5d52485285ae2232930d80 Mon Sep 17 00:00:00 2001 From: Joannis Orlandos Date: Tue, 18 Apr 2017 14:32:33 +0200 Subject: [PATCH] Made data a BSON Primitive again --- Sources/BSON/BSONPrimitive.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/BSON/BSONPrimitive.swift b/Sources/BSON/BSONPrimitive.swift index cee93fb..1c6029d 100644 --- a/Sources/BSON/BSONPrimitive.swift +++ b/Sources/BSON/BSONPrimitive.swift @@ -90,6 +90,16 @@ public struct Timestamp: SimplePrimitive, Equatable { } } +extension Data : SimplePrimitive { + public var typeIdentifier: Byte { + return 0x05 + } + + public func makeBinary() -> Bytes { + return Binary(data: self, withSubtype: .generic).makeBinary() + } +} + public struct Binary: SimplePrimitive { public func convert(_ type: S.Type) -> S? { if self is S {