WIP: objective-C fetching

This commit is contained in:
John Rommel Estropia
2016-03-27 23:02:24 +09:00
parent 789028bc58
commit b8ea7ecf01
26 changed files with 1939 additions and 198 deletions
@@ -48,7 +48,7 @@ public prefix func !(clause: Where) -> Where {
/**
The `Where` clause specifies the conditions for a fetch or a query.
*/
public struct Where: FetchClause, QueryClause, DeleteClause {
public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
/**
Initializes a `Where` clause with an `NSPredicate`
@@ -152,4 +152,21 @@ public struct Where: FetchClause, QueryClause, DeleteClause {
fetchRequest.predicate = self.predicate
}
// MARK: Hashable
public var hashValue: Int {
return self.predicate.hashValue
}
}
// MARK: - Where: Equatable
@warn_unused_result
public func == (lhs: Where, rhs: Where) -> Bool {
return lhs.predicate == rhs.predicate
}