mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-15 13:43:43 +01:00
revert
This commit is contained in:
@@ -21,3 +21,42 @@ public protocol WhereClauseType: AnyWhereClause {
|
||||
*/
|
||||
associatedtype ObjectType: DynamicObject
|
||||
}
|
||||
|
||||
public extension WhereClauseType {
|
||||
|
||||
/**
|
||||
Combines two `Where` predicates together using `AND` operator.
|
||||
- Warning: This operator overload is a workaround for Swift generics' inability to constrain by inheritance (https://bugs.swift.org/browse/SR-5213). In effect, this is less type-safe than other overloads because it allows AND'ing clauses of unrelated `DynamicObject` types.
|
||||
*/
|
||||
public static func && <TWhere: WhereClauseType>(left: Self, right: TWhere) -> Self {
|
||||
|
||||
return Self.init(NSCompoundPredicate(type: .and, subpredicates: [left.predicate, right.predicate]))
|
||||
}
|
||||
|
||||
/**
|
||||
Combines two `Where` predicates together using `AND` operator.
|
||||
- Warning: This operator overload is a workaround for Swift generics' inability to constrain by inheritance (https://bugs.swift.org/browse/SR-5213). In effect, this is less type-safe than other overloads because it allows AND'ing clauses of unrelated `DynamicObject` types.
|
||||
*/
|
||||
public static func && <TWhere: WhereClauseType>(left: TWhere, right: Self) -> Self {
|
||||
|
||||
return Self.init(NSCompoundPredicate(type: .and, subpredicates: [left.predicate, right.predicate]))
|
||||
}
|
||||
|
||||
/**
|
||||
Combines two `Where` predicates together using `OR` operator.
|
||||
- Warning: This operator overload is a workaround for Swift generics' inability to constrain by inheritance (https://bugs.swift.org/browse/SR-5213). In effect, this is less type-safe than other overloads because it allows OR'ing clauses of unrelated `DynamicObject` types.
|
||||
*/
|
||||
public static func || <TWhere: WhereClauseType>(left: Self, right: TWhere) -> Self {
|
||||
|
||||
return Self.init(NSCompoundPredicate(type: .or, subpredicates: [left.predicate, right.predicate]))
|
||||
}
|
||||
|
||||
/**
|
||||
Combines two `Where` predicates together using `OR` operator.
|
||||
- Warning: This operator overload is a workaround for Swift generics' inability to constrain by inheritance (https://bugs.swift.org/browse/SR-5213). In effect, this is less type-safe than other overloads because it allows OR'ing clauses of unrelated `DynamicObject` types.
|
||||
*/
|
||||
public static func || <TWhere: WhereClauseType>(left: TWhere, right: Self) -> Self {
|
||||
|
||||
return Self.init(NSCompoundPredicate(type: .or, subpredicates: [left.predicate, right.predicate]))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user