mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-22 17:39:52 +01:00
Merge branch 'develop' into prototype/Swift_3_2
This commit is contained in:
@@ -172,3 +172,17 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
|
|||||||
return (self.sortDescriptors as NSArray).hashValue
|
return (self.sortDescriptors as NSArray).hashValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: - Sequence where Element == OrderBy
|
||||||
|
|
||||||
|
public extension Sequence where Iterator.Element == OrderBy {
|
||||||
|
|
||||||
|
/**
|
||||||
|
Combines multiple `OrderBy` predicates together
|
||||||
|
*/
|
||||||
|
public func combined() -> OrderBy {
|
||||||
|
|
||||||
|
return OrderBy(self.flatMap({ $0.sortDescriptors }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -216,3 +216,25 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
|
|||||||
return self.predicate.hashValue
|
return self.predicate.hashValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: - Sequence where Element == Where
|
||||||
|
|
||||||
|
public extension Sequence where Iterator.Element == Where {
|
||||||
|
|
||||||
|
/**
|
||||||
|
Combines multiple `Where` predicates together using `AND` operator
|
||||||
|
*/
|
||||||
|
public func combinedByAnd() -> Where {
|
||||||
|
|
||||||
|
return Where(NSCompoundPredicate(type: .and, subpredicates: self.map({ $0.predicate })))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Combines multiple `Where` predicates together using `OR` operator
|
||||||
|
*/
|
||||||
|
public func combinedByOr() -> Where {
|
||||||
|
|
||||||
|
return Where(NSCompoundPredicate(type: .or, subpredicates: self.map({ $0.predicate })))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user