mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-15 21:53:39 +01:00
added .where(combinedByAnd:) and .where(combinedByOr:) to help compiler with long && and || chains
This commit is contained in:
@@ -42,6 +42,28 @@ extension From {
|
||||
return self.fetchChain(appending: clause)
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` that `AND`s the specified `Where` clauses. Use this overload if the compiler cannot infer the types when chaining multiple `&&` operators.
|
||||
|
||||
- parameter clauses: the `Where` clauses to create a `FetchChainBuilder` with
|
||||
- returns: a `FetchChainBuilder` that `AND`s the specified `Where` clauses
|
||||
*/
|
||||
public func `where`(combineByAnd clauses: Where<O>...) -> FetchChainBuilder<O> {
|
||||
|
||||
return self.fetchChain(appending: clauses.combinedByAnd())
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` that `OR`s the specified `Where` clauses. Use this overload if the compiler cannot infer the types when chaining multiple `||` operators.
|
||||
|
||||
- parameter clauses: the `Where` clauses to create a `FetchChainBuilder` with
|
||||
- returns: a `FetchChainBuilder` that `OR`s the specified `Where` clauses
|
||||
*/
|
||||
public func `where`(combineByOr clauses: Where<O>...) -> FetchChainBuilder<O> {
|
||||
|
||||
return self.fetchChain(appending: clauses.combinedByOr())
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` with a predicate using the specified string format and arguments
|
||||
|
||||
@@ -295,11 +317,6 @@ extension From where O: CoreStoreObject {
|
||||
|
||||
return self.fetchChain(appending: clause(O.meta))
|
||||
}
|
||||
|
||||
public func `where`(combinedByAnd clause: Where<O>, _ others: Where<O>...) -> FetchChainBuilder<O> {
|
||||
|
||||
return self.fetchChain(appending: ([clause] + others).combinedByAnd())
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `QueryChainBuilder` that starts with a `Select` clause created from the specified key path
|
||||
@@ -544,6 +561,28 @@ extension FetchChainBuilder {
|
||||
return self.fetchChain(appending: clause)
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` that `AND`s the specified `Where` clauses. Use this overload if the compiler cannot infer the types when chaining multiple `&&` operators.
|
||||
|
||||
- parameter clauses: the `Where` clauses to create a `FetchChainBuilder` with
|
||||
- returns: a `FetchChainBuilder` that `AND`s the specified `Where` clauses
|
||||
*/
|
||||
public func `where`(combineByAnd clauses: Where<O>...) -> FetchChainBuilder<O> {
|
||||
|
||||
return self.fetchChain(appending: clauses.combinedByAnd())
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` that `OR`s the specified `Where` clauses. Use this overload if the compiler cannot infer the types when chaining multiple `||` operators.
|
||||
|
||||
- parameter clauses: the `Where` clauses to create a `FetchChainBuilder` with
|
||||
- returns: a `FetchChainBuilder` that `OR`s the specified `Where` clauses
|
||||
*/
|
||||
public func `where`(combineByOr clauses: Where<O>...) -> FetchChainBuilder<O> {
|
||||
|
||||
return self.fetchChain(appending: clauses.combinedByOr())
|
||||
}
|
||||
|
||||
/**
|
||||
Adds a `Where` clause to the `FetchChainBuilder`
|
||||
|
||||
@@ -682,6 +721,28 @@ extension QueryChainBuilder {
|
||||
return self.queryChain(appending: clause)
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` that `AND`s the specified `Where` clauses. Use this overload if the compiler cannot infer the types when chaining multiple `&&` operators.
|
||||
|
||||
- parameter clauses: the `Where` clauses to create a `FetchChainBuilder` with
|
||||
- returns: a `FetchChainBuilder` that `AND`s the specified `Where` clauses
|
||||
*/
|
||||
public func `where`(combineByAnd clauses: Where<O>...) -> QueryChainBuilder<O> {
|
||||
|
||||
return self.queryChain(appending: clauses.combinedByAnd())
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` that `OR`s the specified `Where` clauses. Use this overload if the compiler cannot infer the types when chaining multiple `||` operators.
|
||||
|
||||
- parameter clauses: the `Where` clauses to create a `FetchChainBuilder` with
|
||||
- returns: a `FetchChainBuilder` that `OR`s the specified `Where` clauses
|
||||
*/
|
||||
public func `where`(combineByOr clauses: Where<O>...) -> QueryChainBuilder<O> {
|
||||
|
||||
return self.queryChain(appending: clauses.combinedByOr())
|
||||
}
|
||||
|
||||
/**
|
||||
Adds a `Where` clause to the `QueryChainBuilder`
|
||||
|
||||
@@ -957,6 +1018,28 @@ extension SectionMonitorChainBuilder {
|
||||
return self.sectionMonitorChain(appending: clause)
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` that `AND`s the specified `Where` clauses. Use this overload if the compiler cannot infer the types when chaining multiple `&&` operators.
|
||||
|
||||
- parameter clauses: the `Where` clauses to create a `FetchChainBuilder` with
|
||||
- returns: a `FetchChainBuilder` that `AND`s the specified `Where` clauses
|
||||
*/
|
||||
public func `where`(combineByAnd clauses: Where<O>...) -> SectionMonitorChainBuilder<O> {
|
||||
|
||||
return self.sectionMonitorChain(appending: clauses.combinedByAnd())
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a `FetchChainBuilder` that `OR`s the specified `Where` clauses. Use this overload if the compiler cannot infer the types when chaining multiple `||` operators.
|
||||
|
||||
- parameter clauses: the `Where` clauses to create a `FetchChainBuilder` with
|
||||
- returns: a `FetchChainBuilder` that `OR`s the specified `Where` clauses
|
||||
*/
|
||||
public func `where`(combineByOr clauses: Where<O>...) -> SectionMonitorChainBuilder<O> {
|
||||
|
||||
return self.sectionMonitorChain(appending: clauses.combinedByOr())
|
||||
}
|
||||
|
||||
/**
|
||||
Adds a `Where` clause to the `SectionMonitorChainBuilder`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user