mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-07-07 13:25:07 +02:00
changed protocol naming
This commit is contained in:
@@ -36,19 +36,6 @@ import CoreData
|
||||
public protocol SelectResultType {}
|
||||
|
||||
|
||||
// MARK: - SelectValueResultType
|
||||
|
||||
/**
|
||||
The `SelectValueResultType` protocol is implemented by return types supported by the `queryValue(...)` methods.
|
||||
*/
|
||||
public protocol SelectValueResultType: SelectResultType {
|
||||
|
||||
static var cs_rawAttributeType: NSAttributeType { get }
|
||||
|
||||
static func cs_fromQueryResultNativeType(_ value: Any) -> Self?
|
||||
}
|
||||
|
||||
|
||||
// MARK: - SelectAttributesResultType
|
||||
|
||||
/**
|
||||
@@ -395,193 +382,6 @@ public extension Select where T: NSManagedObjectID {
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSManagedObjectID: SelectValueResultType
|
||||
|
||||
extension NSManagedObjectID: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Self? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSNumber: SelectValueResultType
|
||||
|
||||
extension NSNumber: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Self? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSString: SelectValueResultType
|
||||
|
||||
extension NSString: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Self? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSDate: SelectValueResultType
|
||||
|
||||
extension NSDate: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Self? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSData: SelectValueResultType
|
||||
|
||||
extension NSData: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Self? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Bool: SelectValueResultType
|
||||
|
||||
extension Bool: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Bool? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int8: SelectValueResultType
|
||||
|
||||
extension Int8: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Int8? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int16: SelectValueResultType
|
||||
|
||||
extension Int16: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Int16? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int32: SelectValueResultType
|
||||
|
||||
extension Int32: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Int32? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int64: SelectValueResultType
|
||||
|
||||
extension Int64: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Int64? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int: SelectValueResultType
|
||||
|
||||
extension Int: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Int? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Double: SelectValueResultType
|
||||
|
||||
extension Double: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Double? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Float: SelectValueResultType
|
||||
|
||||
extension Float: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Float? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - CGFloat: SelectValueResultType
|
||||
|
||||
extension CGFloat: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> CGFloat? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Date: SelectValueResultType
|
||||
|
||||
extension Date: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Date? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - String: SelectValueResultType
|
||||
|
||||
extension String: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> String? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Data: SelectValueResultType
|
||||
|
||||
extension Data: SelectValueResultType {
|
||||
|
||||
public static func cs_fromQueryResultNativeType(_ value: Any) -> Data? {
|
||||
|
||||
return (value as? QueryableNativeType).flatMap(self.cs_fromQueryableNativeType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSDictionary: SelectAttributesResultType
|
||||
|
||||
extension NSDictionary: SelectAttributesResultType {
|
||||
|
||||
@@ -120,7 +120,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
|
||||
- parameter keyPath: the keyPath to compare with
|
||||
- parameter value: the arguments for the `==` operator
|
||||
*/
|
||||
public init<T: CoreStoreQueryableAttributeType>(_ keyPath: KeyPath, isEqualTo value: T?) {
|
||||
public init<T: QueryableAttributeType>(_ keyPath: KeyPath, isEqualTo value: T?) {
|
||||
|
||||
switch value {
|
||||
|
||||
@@ -139,7 +139,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
|
||||
- parameter keyPath: the keyPath to compare with
|
||||
- parameter list: the sequence to check membership of
|
||||
*/
|
||||
public init<S: Sequence>(_ keyPath: KeyPath, isMemberOf list: S) where S.Iterator.Element: CoreStoreQueryableAttributeType {
|
||||
public init<S: Sequence>(_ keyPath: KeyPath, isMemberOf list: S) where S.Iterator.Element: QueryableAttributeType {
|
||||
|
||||
self.init(NSPredicate(format: "\(keyPath) IN %@", list.map({ $0.cs_toQueryableNativeType() }) as NSArray))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user