Merge branch 'develop' into prototype/Swift_3_2

This commit is contained in:
John Rommel Estropia
2017-07-04 23:14:06 +09:00
7 changed files with 148 additions and 1 deletions

View File

@@ -42,6 +42,40 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
return Where(NSCompoundPredicate(type: .and, subpredicates: [left.predicate, right.predicate]))
}
/**
Combines two `Where` predicates together using `AND` operator.
- parameter left: the left hand side `Where` clause
- parameter right: the right hand side `Where` clause
- returns: Return `left` unchanged if `right` is nil
*/
public static func && (left: Where, right: Where?) -> Where {
if right != nil {
return left && right!
}
else {
return left
}
}
/**
Combines two `Where` predicates together using `AND` operator.
- parameter left: the left hand side `Where` clause
- parameter right: the right hand side `Where` clause
- returns: Returns `right` unchanged if `left` is nil
*/
public static func && (left: Where?, right: Where) -> Where {
if left != nil {
return left && right
}
else {
return right
}
}
/**
Combines two `Where` predicates together using `OR` operator
*/
@@ -50,6 +84,40 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
return Where(NSCompoundPredicate(type: .or, subpredicates: [left.predicate, right.predicate]))
}
/**
Combines two `Where` predicates together using `OR` operator.
- parameter left: the left hand side `Where` clause
- parameter right: the right hand side `Where` clause
- returns: Returns `left` unchanged if `right` is nil
*/
public static func || (left: Where, right: Where?) -> Where {
if right != nil {
return left || right!
}
else {
return left
}
}
/**
Combines two `Where` predicates together using `OR` operator.
- parameter left: the left hand side `Where` clause
- parameter right: the right hand side `Where` clause
- returns: Return `right` unchanged if `left` is nil
*/
public static func || (left: Where?, right: Where) -> Where {
if left != nil {
return left || right
}
else {
return right
}
}
/**
Inverts the predicate of a `Where` clause using `NOT` operator
*/