diff --git a/Sources/CoreStoreObject+Querying.swift b/Sources/CoreStoreObject+Querying.swift index 52807e4..3be80f5 100644 --- a/Sources/CoreStoreObject+Querying.swift +++ b/Sources/CoreStoreObject+Querying.swift @@ -61,7 +61,7 @@ public extension ValueContainer.Required { */ public static func < (_ attribute: ValueContainer.Required, _ value: V) -> Where { - return Where("%K < %@", attribute.keyPath, value) + return Where("%K < %@", attribute.keyPath, value.cs_toQueryableNativeType()) } /** @@ -72,7 +72,7 @@ public extension ValueContainer.Required { */ public static func > (_ attribute: ValueContainer.Required, _ value: V) -> Where { - return Where("%K > %@", attribute.keyPath, value) + return Where("%K > %@", attribute.keyPath, value.cs_toQueryableNativeType()) } /** @@ -83,7 +83,7 @@ public extension ValueContainer.Required { */ public static func <= (_ attribute: ValueContainer.Required, _ value: V) -> Where { - return Where("%K <= %@", attribute.keyPath, value) + return Where("%K <= %@", attribute.keyPath, value.cs_toQueryableNativeType()) } /** @@ -94,7 +94,7 @@ public extension ValueContainer.Required { */ public static func >= (_ attribute: ValueContainer.Required, _ value: V) -> Where { - return Where("%K >= %@", attribute.keyPath, value) + return Where("%K >= %@", attribute.keyPath, value.cs_toQueryableNativeType()) } /** @@ -146,7 +146,7 @@ public extension ValueContainer.Optional { if let value = value { - return Where("%K < %@", attribute.keyPath, value) + return Where("%K < %@", attribute.keyPath, value.cs_toQueryableNativeType()) } else { @@ -164,7 +164,7 @@ public extension ValueContainer.Optional { if let value = value { - return Where("%K > %@", attribute.keyPath, value) + return Where("%K > %@", attribute.keyPath, value.cs_toQueryableNativeType()) } else { @@ -182,7 +182,7 @@ public extension ValueContainer.Optional { if let value = value { - return Where("%K <= %@", attribute.keyPath, value) + return Where("%K <= %@", attribute.keyPath, value.cs_toQueryableNativeType()) } else { @@ -200,7 +200,7 @@ public extension ValueContainer.Optional { if let value = value { - return Where("%K >= %@", attribute.keyPath, value) + return Where("%K >= %@", attribute.keyPath, value.cs_toQueryableNativeType()) } else { diff --git a/Sources/KeyPath+Querying.swift b/Sources/KeyPath+Querying.swift index 16ac974..6a38c4e 100644 --- a/Sources/KeyPath+Querying.swift +++ b/Sources/KeyPath+Querying.swift @@ -109,7 +109,7 @@ public func ~= (_ keyPath: KeyPath, _ value: V) -> Where { - return Where("%K < %@", keyPath._kvcKeyPathString!, value) + return Where("%K < %@", keyPath._kvcKeyPathString!, value.cs_toQueryableNativeType()) } /** @@ -120,7 +120,7 @@ public func < (_ key */ public func > (_ keyPath: KeyPath, _ value: V) -> Where { - return Where("%K > %@", keyPath._kvcKeyPathString!, value) + return Where("%K > %@", keyPath._kvcKeyPathString!, value.cs_toQueryableNativeType()) } /** @@ -131,7 +131,7 @@ public func > (_ key */ public func <= (_ keyPath: KeyPath, _ value: V) -> Where { - return Where("%K <= %@", keyPath._kvcKeyPathString!, value) + return Where("%K <= %@", keyPath._kvcKeyPathString!, value.cs_toQueryableNativeType()) } /** @@ -142,7 +142,7 @@ public func <= (_ ke */ public func >= (_ keyPath: KeyPath, _ value: V) -> Where { - return Where("%K >= %@", keyPath._kvcKeyPathString!, value) + return Where("%K >= %@", keyPath._kvcKeyPathString!, value.cs_toQueryableNativeType()) } @@ -158,7 +158,7 @@ public func < (_ key if let value = value { - return Where("%K < %@", keyPath._kvcKeyPathString!, value) + return Where("%K < %@", keyPath._kvcKeyPathString!, value.cs_toQueryableNativeType()) } else { @@ -176,7 +176,7 @@ public func > (_ key if let value = value { - return Where("%K > %@", keyPath._kvcKeyPathString!, value) + return Where("%K > %@", keyPath._kvcKeyPathString!, value.cs_toQueryableNativeType()) } else { @@ -194,7 +194,7 @@ public func <= (_ ke if let value = value { - return Where("%K <= %@", keyPath._kvcKeyPathString!, value) + return Where("%K <= %@", keyPath._kvcKeyPathString!, value.cs_toQueryableNativeType()) } else { @@ -212,7 +212,7 @@ public func >= (_ ke if let value = value { - return Where("%K >= %@", keyPath._kvcKeyPathString!, value) + return Where("%K >= %@", keyPath._kvcKeyPathString!, value.cs_toQueryableNativeType()) } else { @@ -441,7 +441,7 @@ public func ~= (_ sequence: S, _ keyPath: KeyPath(_ keyPath: KeyPath.Required>, _ value: V) -> Where { - return Where("%K < %@", O.meta[keyPath: keyPath].keyPath, value) + return Where("%K < %@", O.meta[keyPath: keyPath].keyPath, value.cs_toQueryableNativeType()) } /** @@ -452,7 +452,7 @@ public func < (_ keyPath: KeyPath.Require */ public func > (_ keyPath: KeyPath.Required>, _ value: V) -> Where { - return Where("%K > %@", O.meta[keyPath: keyPath].keyPath, value) + return Where("%K > %@", O.meta[keyPath: keyPath].keyPath, value.cs_toQueryableNativeType()) } /** @@ -463,7 +463,7 @@ public func > (_ keyPath: KeyPath.Require */ public func <= (_ keyPath: KeyPath.Required>, _ value: V) -> Where { - return Where("%K <= %@", O.meta[keyPath: keyPath].keyPath, value) + return Where("%K <= %@", O.meta[keyPath: keyPath].keyPath, value.cs_toQueryableNativeType()) } /** @@ -474,7 +474,7 @@ public func <= (_ keyPath: KeyPath.Requir */ public func >= (_ keyPath: KeyPath.Required>, _ value: V) -> Where { - return Where("%K >= %@", O.meta[keyPath: keyPath].keyPath, value) + return Where("%K >= %@", O.meta[keyPath: keyPath].keyPath, value.cs_toQueryableNativeType()) } @@ -490,7 +490,7 @@ public func < (_ keyPath: KeyPath.Optional>, _ val if let value = value { - return Where("%K < %@", O.meta[keyPath: keyPath].keyPath, value) + return Where("%K < %@", O.meta[keyPath: keyPath].keyPath, value.cs_toQueryableNativeType()) } else { @@ -508,7 +508,7 @@ public func > (_ keyPath: KeyPath.Optional>, _ val if let value = value { - return Where("%K > %@", O.meta[keyPath: keyPath].keyPath, value) + return Where("%K > %@", O.meta[keyPath: keyPath].keyPath, value.cs_toQueryableNativeType()) } else { @@ -526,7 +526,7 @@ public func <= (_ keyPath: KeyPath.Optional>, _ va if let value = value { - return Where("%K <= %@", O.meta[keyPath: keyPath].keyPath, value) + return Where("%K <= %@", O.meta[keyPath: keyPath].keyPath, value.cs_toQueryableNativeType()) } else { @@ -544,7 +544,7 @@ public func >= (_ keyPath: KeyPath.Optional>, _ va if let value = value { - return Where("%K >= %@", O.meta[keyPath: keyPath].keyPath, value) + return Where("%K >= %@", O.meta[keyPath: keyPath].keyPath, value.cs_toQueryableNativeType()) } else {