Unify generic labeling

This commit is contained in:
John Estropia
2019-10-22 16:16:47 +09:00
parent 3d8bdf1cf3
commit 80166a42bb
37 changed files with 711 additions and 639 deletions

View File

@@ -37,7 +37,7 @@ extension From {
- parameter clause: the `Where` clause to create a `FetchChainBuilder` with
- returns: a `FetchChainBuilder` that starts with the specified `Where` clause
*/
public func `where`(_ clause: Where<D>) -> FetchChainBuilder<D> {
public func `where`(_ clause: Where<O>) -> FetchChainBuilder<O> {
return self.fetchChain(appending: clause)
}
@@ -49,9 +49,9 @@ extension From {
- parameter args: the arguments for `format`
- returns: a `FetchChainBuilder` with a predicate using the specified string format and arguments
*/
public func `where`(format: String, _ args: Any...) -> FetchChainBuilder<D> {
public func `where`(format: String, _ args: Any...) -> FetchChainBuilder<O> {
return self.fetchChain(appending: Where<D>(format, argumentArray: args))
return self.fetchChain(appending: Where<O>(format, argumentArray: args))
}
/**
@@ -61,9 +61,9 @@ extension From {
- parameter argumentArray: the arguments for `format`
- returns: a `FetchChainBuilder` with a predicate using the specified string format and arguments
*/
public func `where`(format: String, argumentArray: [Any]?) -> FetchChainBuilder<D> {
public func `where`(format: String, argumentArray: [Any]?) -> FetchChainBuilder<O> {
return self.fetchChain(appending: Where<D>(format, argumentArray: argumentArray))
return self.fetchChain(appending: Where<O>(format, argumentArray: argumentArray))
}
/**
@@ -72,7 +72,7 @@ extension From {
- parameter clause: the `OrderBy` clause to create a `FetchChainBuilder` with
- returns: a `FetchChainBuilder` that starts with the specified `OrderBy` clause
*/
public func orderBy(_ clause: OrderBy<D>) -> FetchChainBuilder<D> {
public func orderBy(_ clause: OrderBy<O>) -> FetchChainBuilder<O> {
return self.fetchChain(appending: clause)
}
@@ -84,9 +84,9 @@ extension From {
- parameter sortKeys: a series of other `SortKey`s
- returns: a `FetchChainBuilder` with a series of `SortKey`s
*/
public func orderBy(_ sortKey: OrderBy<D>.SortKey, _ sortKeys: OrderBy<D>.SortKey...) -> FetchChainBuilder<D> {
public func orderBy(_ sortKey: OrderBy<O>.SortKey, _ sortKeys: OrderBy<O>.SortKey...) -> FetchChainBuilder<O> {
return self.fetchChain(appending: OrderBy<D>([sortKey] + sortKeys))
return self.fetchChain(appending: OrderBy<O>([sortKey] + sortKeys))
}
/**
@@ -95,9 +95,9 @@ extension From {
- parameter sortKeys: a series of `SortKey`s
- returns: a `FetchChainBuilder` with a series of `SortKey`s
*/
public func orderBy(_ sortKeys: [OrderBy<D>.SortKey]) -> FetchChainBuilder<D> {
public func orderBy(_ sortKeys: [OrderBy<O>.SortKey]) -> FetchChainBuilder<O> {
return self.fetchChain(appending: OrderBy<D>(sortKeys))
return self.fetchChain(appending: OrderBy<O>(sortKeys))
}
/**
@@ -106,7 +106,7 @@ extension From {
- parameter fetchRequest: the block to customize the `NSFetchRequest`
- returns: a `FetchChainBuilder` with closure where the `NSFetchRequest` may be configured
*/
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> FetchChainBuilder<D> {
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> FetchChainBuilder<O> {
return self.fetchChain(appending: Tweak(fetchRequest))
}
@@ -117,7 +117,7 @@ extension From {
- parameter clause: the `FetchClause` to add to the `FetchChainBuilder`
- returns: a `FetchChainBuilder` containing the specified `FetchClause`
*/
public func appending(_ clause: FetchClause) -> FetchChainBuilder<D> {
public func appending(_ clause: FetchClause) -> FetchChainBuilder<O> {
return self.fetchChain(appending: clause)
}
@@ -128,7 +128,7 @@ extension From {
- parameter clauses: the `FetchClause`s to add to the `FetchChainBuilder`
- returns: a `FetchChainBuilder` containing the specified `FetchClause`s
*/
public func appending<S: Sequence>(contentsOf clauses: S) -> FetchChainBuilder<D> where S.Element == FetchClause {
public func appending<S: Sequence>(contentsOf clauses: S) -> FetchChainBuilder<O> where S.Element == FetchClause {
return self.fetchChain(appending: clauses)
}
@@ -139,7 +139,7 @@ extension From {
- parameter clause: the `Select` clause to create a `QueryChainBuilder` with
- returns: a `QueryChainBuilder` that starts with the specified `Select` clause
*/
public func select<R>(_ clause: Select<D, R>) -> QueryChainBuilder<D, R> {
public func select<R>(_ clause: Select<O, R>) -> QueryChainBuilder<O, R> {
return .init(
from: self,
@@ -156,7 +156,7 @@ extension From {
- parameter selectTerms: a series of `SelectTerm`s
- returns: a `QueryChainBuilder` that starts with a `Select` clause created from the specified `SelectTerm`s
*/
public func select<R>(_ resultType: R.Type, _ selectTerm: SelectTerm<D>, _ selectTerms: SelectTerm<D>...) -> QueryChainBuilder<D, R> {
public func select<R>(_ resultType: R.Type, _ selectTerm: SelectTerm<O>, _ selectTerms: SelectTerm<O>...) -> QueryChainBuilder<O, R> {
return self.select(resultType, [selectTerm] + selectTerms)
}
@@ -168,7 +168,7 @@ extension From {
- parameter selectTerms: a series of `SelectTerm`s
- returns: a `QueryChainBuilder` that starts with a `Select` clause created from the specified `SelectTerm`s
*/
public func select<R>(_ resultType: R.Type, _ selectTerms: [SelectTerm<D>]) -> QueryChainBuilder<D, R> {
public func select<R>(_ resultType: R.Type, _ selectTerms: [SelectTerm<O>]) -> QueryChainBuilder<O, R> {
return .init(
from: self,
@@ -184,7 +184,7 @@ extension From {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy(_ clause: SectionBy<D>) -> SectionMonitorChainBuilder<D> {
public func sectionBy(_ clause: SectionBy<O>) -> SectionMonitorChainBuilder<O> {
return .init(
from: self,
@@ -200,7 +200,7 @@ extension From {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy(_ sectionKeyPath: KeyPathString) -> SectionMonitorChainBuilder<D> {
public func sectionBy(_ sectionKeyPath: KeyPathString) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(sectionKeyPath, { $0 })
}
@@ -214,7 +214,7 @@ extension From {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy(_ sectionKeyPath: KeyPathString, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<D> {
public func sectionBy(_ sectionKeyPath: KeyPathString, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<O> {
return .init(
from: self,
@@ -226,21 +226,21 @@ extension From {
// MARK: Private
private func fetchChain(appending clause: FetchClause) -> FetchChainBuilder<D> {
private func fetchChain(appending clause: FetchClause) -> FetchChainBuilder<O> {
return .init(from: self, fetchClauses: [clause])
}
private func fetchChain<S: Sequence>(appending clauses: S) -> FetchChainBuilder<D> where S.Element == FetchClause {
private func fetchChain<S: Sequence>(appending clauses: S) -> FetchChainBuilder<O> where S.Element == FetchClause {
return .init(from: self, fetchClauses: Array(clauses))
}
}
// MARK: - From where D: NSManagedObject
// MARK: - From where O: NSManagedObject
extension From where D: NSManagedObject {
extension From where O: NSManagedObject {
/**
Creates a `QueryChainBuilder` that starts with a `Select` clause created from the specified key path
@@ -248,9 +248,9 @@ extension From where D: NSManagedObject {
- parameter keyPath: the keyPath to query the value for
- returns: a `QueryChainBuilder` that starts with a `Select` clause created from the specified key path
*/
public func select<R>(_ keyPath: KeyPath<D, R>) -> QueryChainBuilder<D, R> {
public func select<R>(_ keyPath: KeyPath<O, R>) -> QueryChainBuilder<O, R> {
return self.select(R.self, [SelectTerm<D>.attribute(keyPath)])
return self.select(R.self, [SelectTerm<O>.attribute(keyPath)])
}
/**
@@ -260,7 +260,7 @@ extension From where D: NSManagedObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, T>) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, T>) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(sectionKeyPath._kvcKeyPathString!, { $0 })
}
@@ -274,16 +274,16 @@ extension From where D: NSManagedObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, T>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, T>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(sectionKeyPath._kvcKeyPathString!, sectionIndexTransformer)
}
}
// MARK: - From where D: CoreStoreObject
// MARK: - From where O: CoreStoreObject
extension From where D: CoreStoreObject {
extension From where O: CoreStoreObject {
/**
Creates a `FetchChainBuilder` that starts with the specified `Where` clause
@@ -291,12 +291,12 @@ extension From where D: CoreStoreObject {
- parameter clause: a closure that returns a `Where` clause
- returns: a `FetchChainBuilder` that starts with the specified `Where` clause
*/
public func `where`<T: AnyWhereClause>(_ clause: (D) -> T) -> FetchChainBuilder<D> {
public func `where`<T: AnyWhereClause>(_ clause: (O) -> T) -> FetchChainBuilder<O> {
return self.fetchChain(appending: clause(D.meta))
return self.fetchChain(appending: clause(O.meta))
}
public func `where`(combinedByAnd clause: Where<D>, _ others: Where<D>...) -> FetchChainBuilder<D> {
public func `where`(combinedByAnd clause: Where<O>, _ others: Where<O>...) -> FetchChainBuilder<O> {
return self.fetchChain(appending: ([clause] + others).combinedByAnd())
}
@@ -307,9 +307,9 @@ extension From where D: CoreStoreObject {
- parameter keyPath: the keyPath to query the value for
- returns: a `QueryChainBuilder` that starts with a `Select` clause created from the specified key path
*/
public func select<R>(_ keyPath: KeyPath<D, ValueContainer<D>.Required<R>>) -> QueryChainBuilder<D, R> {
public func select<R>(_ keyPath: KeyPath<O, ValueContainer<O>.Required<R>>) -> QueryChainBuilder<O, R> {
return self.select(R.self, [SelectTerm<D>.attribute(keyPath)])
return self.select(R.self, [SelectTerm<O>.attribute(keyPath)])
}
/**
@@ -318,9 +318,9 @@ extension From where D: CoreStoreObject {
- parameter keyPath: the keyPath to query the value for
- returns: a `QueryChainBuilder` that starts with a `Select` clause created from the specified key path
*/
public func select<R>(_ keyPath: KeyPath<D, ValueContainer<D>.Optional<R>>) -> QueryChainBuilder<D, R> {
public func select<R>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<R>>) -> QueryChainBuilder<O, R> {
return self.select(R.self, [SelectTerm<D>.attribute(keyPath)])
return self.select(R.self, [SelectTerm<O>.attribute(keyPath)])
}
/**
@@ -329,9 +329,9 @@ extension From where D: CoreStoreObject {
- parameter keyPath: the keyPath to query the value for
- returns: a `QueryChainBuilder` that starts with a `Select` clause created from the specified key path
*/
public func select<R>(_ keyPath: KeyPath<D, TransformableContainer<D>.Required<R>>) -> QueryChainBuilder<D, R> {
public func select<R>(_ keyPath: KeyPath<O, TransformableContainer<O>.Required<R>>) -> QueryChainBuilder<O, R> {
return self.select(R.self, [SelectTerm<D>.attribute(keyPath)])
return self.select(R.self, [SelectTerm<O>.attribute(keyPath)])
}
/**
@@ -340,9 +340,9 @@ extension From where D: CoreStoreObject {
- parameter keyPath: the keyPath to query the value for
- returns: a `QueryChainBuilder` that starts with a `Select` clause created from the specified key path
*/
public func select<R>(_ keyPath: KeyPath<D, TransformableContainer<D>.Optional<R>>) -> QueryChainBuilder<D, R> {
public func select<R>(_ keyPath: KeyPath<O, TransformableContainer<O>.Optional<R>>) -> QueryChainBuilder<O, R> {
return self.select(R.self, [SelectTerm<D>.attribute(keyPath)])
return self.select(R.self, [SelectTerm<O>.attribute(keyPath)])
}
/**
@@ -352,9 +352,9 @@ extension From where D: CoreStoreObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, ValueContainer<D>.Required<T>>) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Required<T>>) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(D.meta[keyPath: sectionKeyPath].keyPath, { $0 })
return self.sectionBy(O.meta[keyPath: sectionKeyPath].keyPath, { $0 })
}
/**
@@ -364,9 +364,9 @@ extension From where D: CoreStoreObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, ValueContainer<D>.Optional<T>>) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Optional<T>>) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(D.meta[keyPath: sectionKeyPath].keyPath, { $0 })
return self.sectionBy(O.meta[keyPath: sectionKeyPath].keyPath, { $0 })
}
/**
@@ -376,9 +376,9 @@ extension From where D: CoreStoreObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, TransformableContainer<D>.Required<T>>) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Required<T>>) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(D.meta[keyPath: sectionKeyPath].keyPath, { $0 })
return self.sectionBy(O.meta[keyPath: sectionKeyPath].keyPath, { $0 })
}
/**
@@ -388,9 +388,9 @@ extension From where D: CoreStoreObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, TransformableContainer<D>.Optional<T>>) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(D.meta[keyPath: sectionKeyPath].keyPath, { $0 })
return self.sectionBy(O.meta[keyPath: sectionKeyPath].keyPath, { $0 })
}
/**
@@ -402,9 +402,9 @@ extension From where D: CoreStoreObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, ValueContainer<D>.Required<T>>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Required<T>>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(D.meta[keyPath: sectionKeyPath].keyPath, sectionIndexTransformer)
return self.sectionBy(O.meta[keyPath: sectionKeyPath].keyPath, sectionIndexTransformer)
}
/**
@@ -416,9 +416,9 @@ extension From where D: CoreStoreObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, ValueContainer<D>.Optional<T>>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, ValueContainer<O>.Optional<T>>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(D.meta[keyPath: sectionKeyPath].keyPath, sectionIndexTransformer)
return self.sectionBy(O.meta[keyPath: sectionKeyPath].keyPath, sectionIndexTransformer)
}
/**
@@ -430,9 +430,9 @@ extension From where D: CoreStoreObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, TransformableContainer<D>.Required<T>>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Required<T>>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(D.meta[keyPath: sectionKeyPath].keyPath, sectionIndexTransformer)
return self.sectionBy(O.meta[keyPath: sectionKeyPath].keyPath, sectionIndexTransformer)
}
/**
@@ -444,9 +444,9 @@ extension From where D: CoreStoreObject {
- returns: a `SectionMonitorChainBuilder` that is sectioned by the specified key path
*/
@available(macOS 10.12, *)
public func sectionBy<T>(_ sectionKeyPath: KeyPath<D, TransformableContainer<D>.Optional<T>>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<D> {
public func sectionBy<T>(_ sectionKeyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>, _ sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> SectionMonitorChainBuilder<O> {
return self.sectionBy(D.meta[keyPath: sectionKeyPath].keyPath, sectionIndexTransformer)
return self.sectionBy(O.meta[keyPath: sectionKeyPath].keyPath, sectionIndexTransformer)
}
}
@@ -461,7 +461,7 @@ extension FetchChainBuilder {
- parameter clause: a `Where` clause to add to the fetch builder
- returns: a new `FetchChainBuilder` containing the `Where` clause
*/
public func `where`(_ clause: Where<D>) -> FetchChainBuilder<D> {
public func `where`(_ clause: Where<O>) -> FetchChainBuilder<O> {
return self.fetchChain(appending: clause)
}
@@ -473,9 +473,9 @@ extension FetchChainBuilder {
- parameter args: the arguments for `format`
- returns: a new `FetchChainBuilder` containing the `Where` clause
*/
public func `where`(format: String, _ args: Any...) -> FetchChainBuilder<D> {
public func `where`(format: String, _ args: Any...) -> FetchChainBuilder<O> {
return self.fetchChain(appending: Where<D>(format, argumentArray: args))
return self.fetchChain(appending: Where<O>(format, argumentArray: args))
}
/**
@@ -485,9 +485,9 @@ extension FetchChainBuilder {
- parameter argumentArray: the arguments for `format`
- returns: a new `FetchChainBuilder` containing the `Where` clause
*/
public func `where`(format: String, argumentArray: [Any]?) -> FetchChainBuilder<D> {
public func `where`(format: String, argumentArray: [Any]?) -> FetchChainBuilder<O> {
return self.fetchChain(appending: Where<D>(format, argumentArray: argumentArray))
return self.fetchChain(appending: Where<O>(format, argumentArray: argumentArray))
}
/**
@@ -496,7 +496,7 @@ extension FetchChainBuilder {
- parameter clause: the `OrderBy` clause to add
- returns: a new `FetchChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ clause: OrderBy<D>) -> FetchChainBuilder<D> {
public func orderBy(_ clause: OrderBy<O>) -> FetchChainBuilder<O> {
return self.fetchChain(appending: clause)
}
@@ -508,9 +508,9 @@ extension FetchChainBuilder {
- parameter sortKeys: a series of other `SortKey`s
- returns: a new `FetchChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ sortKey: OrderBy<D>.SortKey, _ sortKeys: OrderBy<D>.SortKey...) -> FetchChainBuilder<D> {
public func orderBy(_ sortKey: OrderBy<O>.SortKey, _ sortKeys: OrderBy<O>.SortKey...) -> FetchChainBuilder<O> {
return self.fetchChain(appending: OrderBy<D>([sortKey] + sortKeys))
return self.fetchChain(appending: OrderBy<O>([sortKey] + sortKeys))
}
/**
@@ -519,9 +519,9 @@ extension FetchChainBuilder {
- parameter sortKeys: a series of `SortKey`s
- returns: a new `FetchChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ sortKeys: [OrderBy<D>.SortKey]) -> FetchChainBuilder<D> {
public func orderBy(_ sortKeys: [OrderBy<O>.SortKey]) -> FetchChainBuilder<O> {
return self.fetchChain(appending: OrderBy<D>(sortKeys))
return self.fetchChain(appending: OrderBy<O>(sortKeys))
}
/**
@@ -530,7 +530,7 @@ extension FetchChainBuilder {
- parameter fetchRequest: the block to customize the `NSFetchRequest`
- returns: a new `FetchChainBuilder` containing the `Tweak` clause
*/
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> FetchChainBuilder<D> {
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> FetchChainBuilder<O> {
return self.fetchChain(appending: Tweak(fetchRequest))
}
@@ -541,7 +541,7 @@ extension FetchChainBuilder {
- parameter clause: the `FetchClause` to add to the `FetchChainBuilder`
- returns: a new `FetchChainBuilder` containing the `FetchClause`
*/
public func appending(_ clause: FetchClause) -> FetchChainBuilder<D> {
public func appending(_ clause: FetchClause) -> FetchChainBuilder<O> {
return self.fetchChain(appending: clause)
}
@@ -552,7 +552,7 @@ extension FetchChainBuilder {
- parameter clauses: the `FetchClause`s to add to the `FetchChainBuilder`
- returns: a new `FetchChainBuilder` containing the `FetchClause`s
*/
public func appending<S: Sequence>(contentsOf clauses: S) -> FetchChainBuilder<D> where S.Element == FetchClause {
public func appending<S: Sequence>(contentsOf clauses: S) -> FetchChainBuilder<O> where S.Element == FetchClause {
return self.fetchChain(appending: clauses)
}
@@ -560,7 +560,7 @@ extension FetchChainBuilder {
// MARK: Private
private func fetchChain(appending clause: FetchClause) -> FetchChainBuilder<D> {
private func fetchChain(appending clause: FetchClause) -> FetchChainBuilder<O> {
return .init(
from: self.from,
@@ -568,7 +568,7 @@ extension FetchChainBuilder {
)
}
private func fetchChain<S: Sequence>(appending clauses: S) -> FetchChainBuilder<D> where S.Element == FetchClause {
private func fetchChain<S: Sequence>(appending clauses: S) -> FetchChainBuilder<O> where S.Element == FetchClause {
return .init(
from: self.from,
@@ -578,13 +578,13 @@ extension FetchChainBuilder {
}
// MARK: - FetchChainBuilder where D: CoreStoreObject
// MARK: - FetchChainBuilder where O: CoreStoreObject
extension FetchChainBuilder where D: CoreStoreObject {
extension FetchChainBuilder where O: CoreStoreObject {
public func `where`<T: AnyWhereClause>(_ clause: (D) -> T) -> FetchChainBuilder<D> {
public func `where`<T: AnyWhereClause>(_ clause: (O) -> T) -> FetchChainBuilder<O> {
return self.fetchChain(appending: clause(D.meta))
return self.fetchChain(appending: clause(O.meta))
}
}
@@ -599,7 +599,7 @@ extension QueryChainBuilder {
- parameter clause: a `Where` clause to add to the query builder
- returns: a new `QueryChainBuilder` containing the `Where` clause
*/
public func `where`(_ clause: Where<D>) -> QueryChainBuilder<D, R> {
public func `where`(_ clause: Where<O>) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: clause)
}
@@ -611,9 +611,9 @@ extension QueryChainBuilder {
- parameter args: the arguments for `format`
- returns: a new `QueryChainBuilder` containing the `Where` clause
*/
public func `where`(format: String, _ args: Any...) -> QueryChainBuilder<D, R> {
public func `where`(format: String, _ args: Any...) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: Where<D>(format, argumentArray: args))
return self.queryChain(appending: Where<O>(format, argumentArray: args))
}
/**
@@ -623,9 +623,9 @@ extension QueryChainBuilder {
- parameter argumentArray: the arguments for `format`
- returns: a new `QueryChainBuilder` containing the `Where` clause
*/
public func `where`(format: String, argumentArray: [Any]?) -> QueryChainBuilder<D, R> {
public func `where`(format: String, argumentArray: [Any]?) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: Where<D>(format, argumentArray: argumentArray))
return self.queryChain(appending: Where<O>(format, argumentArray: argumentArray))
}
/**
@@ -634,7 +634,7 @@ extension QueryChainBuilder {
- parameter clause: the `OrderBy` clause to add
- returns: a new `QueryChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ clause: OrderBy<D>) -> QueryChainBuilder<D, R> {
public func orderBy(_ clause: OrderBy<O>) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: clause)
}
@@ -646,9 +646,9 @@ extension QueryChainBuilder {
- parameter sortKeys: a series of other `SortKey`s
- returns: a new `QueryChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ sortKey: OrderBy<D>.SortKey, _ sortKeys: OrderBy<D>.SortKey...) -> QueryChainBuilder<D, R> {
public func orderBy(_ sortKey: OrderBy<O>.SortKey, _ sortKeys: OrderBy<O>.SortKey...) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: OrderBy<D>([sortKey] + sortKeys))
return self.queryChain(appending: OrderBy<O>([sortKey] + sortKeys))
}
/**
@@ -657,9 +657,9 @@ extension QueryChainBuilder {
- parameter sortKeys: a series of `SortKey`s
- returns: a new `QueryChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ sortKeys: [OrderBy<D>.SortKey]) -> QueryChainBuilder<D, R> {
public func orderBy(_ sortKeys: [OrderBy<O>.SortKey]) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: OrderBy<D>(sortKeys))
return self.queryChain(appending: OrderBy<O>(sortKeys))
}
/**
@@ -668,7 +668,7 @@ extension QueryChainBuilder {
- parameter fetchRequest: the block to customize the `NSFetchRequest`
- returns: a new `QueryChainBuilder` containing the `Tweak` clause
*/
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> QueryChainBuilder<D, R> {
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: Tweak(fetchRequest))
}
@@ -679,7 +679,7 @@ extension QueryChainBuilder {
- parameter clause: a `GroupBy` clause to add to the query builder
- returns: a new `QueryChainBuilder` containing the `GroupBy` clause
*/
public func groupBy(_ clause: GroupBy<D>) -> QueryChainBuilder<D, R> {
public func groupBy(_ clause: GroupBy<O>) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: clause)
}
@@ -691,9 +691,9 @@ extension QueryChainBuilder {
- parameter keyPaths: other key paths to group the query results with
- returns: a new `QueryChainBuilder` containing the `GroupBy` clause
*/
public func groupBy(_ keyPath: KeyPathString, _ keyPaths: KeyPathString...) -> QueryChainBuilder<D, R> {
public func groupBy(_ keyPath: KeyPathString, _ keyPaths: KeyPathString...) -> QueryChainBuilder<O, R> {
return self.groupBy(GroupBy<D>([keyPath] + keyPaths))
return self.groupBy(GroupBy<O>([keyPath] + keyPaths))
}
/**
@@ -702,9 +702,9 @@ extension QueryChainBuilder {
- parameter keyPaths: a series of key paths to group the query results with
- returns: a new `QueryChainBuilder` containing the `GroupBy` clause
*/
public func groupBy(_ keyPaths: [KeyPathString]) -> QueryChainBuilder<D, R> {
public func groupBy(_ keyPaths: [KeyPathString]) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: GroupBy<D>(keyPaths))
return self.queryChain(appending: GroupBy<O>(keyPaths))
}
/**
@@ -713,7 +713,7 @@ extension QueryChainBuilder {
- parameter clause: the `QueryClause` to add to the `QueryChainBuilder`
- returns: a new `QueryChainBuilder` containing the `QueryClause`
*/
public func appending(_ clause: QueryClause) -> QueryChainBuilder<D, R> {
public func appending(_ clause: QueryClause) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: clause)
}
@@ -724,7 +724,7 @@ extension QueryChainBuilder {
- parameter clauses: the `QueryClause`s to add to the `QueryChainBuilder`
- returns: a new `QueryChainBuilder` containing the `QueryClause`s
*/
public func appending<S: Sequence>(contentsOf clauses: S) -> QueryChainBuilder<D, R> where S.Element == QueryClause {
public func appending<S: Sequence>(contentsOf clauses: S) -> QueryChainBuilder<O, R> where S.Element == QueryClause {
return self.queryChain(appending: clauses)
}
@@ -732,7 +732,7 @@ extension QueryChainBuilder {
// MARK: Private
private func queryChain(appending clause: QueryClause) -> QueryChainBuilder<D, R> {
private func queryChain(appending clause: QueryClause) -> QueryChainBuilder<O, R> {
return .init(
from: self.from,
@@ -741,7 +741,7 @@ extension QueryChainBuilder {
)
}
private func queryChain<S: Sequence>(appending clauses: S) -> QueryChainBuilder<D, R> where S.Element == QueryClause {
private func queryChain<S: Sequence>(appending clauses: S) -> QueryChainBuilder<O, R> where S.Element == QueryClause {
return .init(
from: self.from,
@@ -752,9 +752,9 @@ extension QueryChainBuilder {
}
// MARK: - QueryChainBuilder where D: NSManagedObject
// MARK: - QueryChainBuilder where O: NSManagedObject
extension QueryChainBuilder where D: NSManagedObject {
extension QueryChainBuilder where O: NSManagedObject {
/**
Adds a `GroupBy` clause to the `QueryChainBuilder`
@@ -762,16 +762,16 @@ extension QueryChainBuilder where D: NSManagedObject {
- parameter keyPath: a key path to group the query results with
- returns: a new `QueryChainBuilder` containing the `GroupBy` clause
*/
public func groupBy<T>(_ keyPath: KeyPath<D, T>) -> QueryChainBuilder<D, R> {
public func groupBy<T>(_ keyPath: KeyPath<O, T>) -> QueryChainBuilder<O, R> {
return self.groupBy(GroupBy<D>(keyPath))
return self.groupBy(GroupBy<O>(keyPath))
}
}
// MARK: - QueryChainBuilder where D: CoreStoreObject
// MARK: - QueryChainBuilder where O: CoreStoreObject
extension QueryChainBuilder where D: CoreStoreObject {
extension QueryChainBuilder where O: CoreStoreObject {
/**
Adds a `Where` clause to the `QueryChainBuilder`
@@ -779,9 +779,9 @@ extension QueryChainBuilder where D: CoreStoreObject {
- parameter clause: a `Where` clause to add to the query builder
- returns: a new `QueryChainBuilder` containing the `Where` clause
*/
public func `where`<T: AnyWhereClause>(_ clause: (D) -> T) -> QueryChainBuilder<D, R> {
public func `where`<T: AnyWhereClause>(_ clause: (O) -> T) -> QueryChainBuilder<O, R> {
return self.queryChain(appending: clause(D.meta))
return self.queryChain(appending: clause(O.meta))
}
/**
@@ -790,9 +790,9 @@ extension QueryChainBuilder where D: CoreStoreObject {
- parameter keyPath: a key path to group the query results with
- returns: a new `QueryChainBuilder` containing the `GroupBy` clause
*/
public func groupBy<T>(_ keyPath: KeyPath<D, ValueContainer<D>.Required<T>>) -> QueryChainBuilder<D, R> {
public func groupBy<T>(_ keyPath: KeyPath<O, ValueContainer<O>.Required<T>>) -> QueryChainBuilder<O, R> {
return self.groupBy(GroupBy<D>(keyPath))
return self.groupBy(GroupBy<O>(keyPath))
}
/**
@@ -801,9 +801,9 @@ extension QueryChainBuilder where D: CoreStoreObject {
- parameter keyPath: a key path to group the query results with
- returns: a new `QueryChainBuilder` containing the `GroupBy` clause
*/
public func groupBy<T>(_ keyPath: KeyPath<D, ValueContainer<D>.Optional<T>>) -> QueryChainBuilder<D, R> {
public func groupBy<T>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<T>>) -> QueryChainBuilder<O, R> {
return self.groupBy(GroupBy<D>(keyPath))
return self.groupBy(GroupBy<O>(keyPath))
}
/**
@@ -812,9 +812,9 @@ extension QueryChainBuilder where D: CoreStoreObject {
- parameter keyPath: a key path to group the query results with
- returns: a new `QueryChainBuilder` containing the `GroupBy` clause
*/
public func groupBy<T>(_ keyPath: KeyPath<D, TransformableContainer<D>.Required<T>>) -> QueryChainBuilder<D, R> {
public func groupBy<T>(_ keyPath: KeyPath<O, TransformableContainer<O>.Required<T>>) -> QueryChainBuilder<O, R> {
return self.groupBy(GroupBy<D>(keyPath))
return self.groupBy(GroupBy<O>(keyPath))
}
/**
@@ -823,9 +823,9 @@ extension QueryChainBuilder where D: CoreStoreObject {
- parameter keyPath: a key path to group the query results with
- returns: a new `QueryChainBuilder` containing the `GroupBy` clause
*/
public func groupBy<T>(_ keyPath: KeyPath<D, TransformableContainer<D>.Optional<T>>) -> QueryChainBuilder<D, R> {
public func groupBy<T>(_ keyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>) -> QueryChainBuilder<O, R> {
return self.groupBy(GroupBy<D>(keyPath))
return self.groupBy(GroupBy<O>(keyPath))
}
}
@@ -841,7 +841,7 @@ extension SectionMonitorChainBuilder {
- parameter clause: a `Where` clause to add to the fetch builder
- returns: a new `SectionMonitorChainBuilder` containing the `Where` clause
*/
public func `where`(_ clause: Where<D>) -> SectionMonitorChainBuilder<D> {
public func `where`(_ clause: Where<O>) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: clause)
}
@@ -853,9 +853,9 @@ extension SectionMonitorChainBuilder {
- parameter args: the arguments for `format`
- returns: a new `SectionMonitorChainBuilder` containing the `Where` clause
*/
public func `where`(format: String, _ args: Any...) -> SectionMonitorChainBuilder<D> {
public func `where`(format: String, _ args: Any...) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: Where<D>(format, argumentArray: args))
return self.sectionMonitorChain(appending: Where<O>(format, argumentArray: args))
}
/**
@@ -865,9 +865,9 @@ extension SectionMonitorChainBuilder {
- parameter argumentArray: the arguments for `format`
- returns: a new `SectionMonitorChainBuilder` containing the `Where` clause
*/
public func `where`(format: String, argumentArray: [Any]?) -> SectionMonitorChainBuilder<D> {
public func `where`(format: String, argumentArray: [Any]?) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: Where<D>(format, argumentArray: argumentArray))
return self.sectionMonitorChain(appending: Where<O>(format, argumentArray: argumentArray))
}
/**
@@ -876,7 +876,7 @@ extension SectionMonitorChainBuilder {
- parameter clause: the `OrderBy` clause to add
- returns: a new `SectionMonitorChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ clause: OrderBy<D>) -> SectionMonitorChainBuilder<D> {
public func orderBy(_ clause: OrderBy<O>) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: clause)
}
@@ -888,9 +888,9 @@ extension SectionMonitorChainBuilder {
- parameter sortKeys: a series of other `SortKey`s
- returns: a new `SectionMonitorChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ sortKey: OrderBy<D>.SortKey, _ sortKeys: OrderBy<D>.SortKey...) -> SectionMonitorChainBuilder<D> {
public func orderBy(_ sortKey: OrderBy<O>.SortKey, _ sortKeys: OrderBy<O>.SortKey...) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: OrderBy<D>([sortKey] + sortKeys))
return self.sectionMonitorChain(appending: OrderBy<O>([sortKey] + sortKeys))
}
/**
@@ -899,9 +899,9 @@ extension SectionMonitorChainBuilder {
- parameter sortKeys: a series of `SortKey`s
- returns: a new `SectionMonitorChainBuilder` containing the `OrderBy` clause
*/
public func orderBy(_ sortKeys: [OrderBy<D>.SortKey]) -> SectionMonitorChainBuilder<D> {
public func orderBy(_ sortKeys: [OrderBy<O>.SortKey]) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: OrderBy<D>(sortKeys))
return self.sectionMonitorChain(appending: OrderBy<O>(sortKeys))
}
/**
@@ -910,7 +910,7 @@ extension SectionMonitorChainBuilder {
- parameter fetchRequest: the block to customize the `NSFetchRequest`
- returns: a new `SectionMonitorChainBuilder` containing the `Tweak` clause
*/
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> SectionMonitorChainBuilder<D> {
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: Tweak(fetchRequest))
}
@@ -921,7 +921,7 @@ extension SectionMonitorChainBuilder {
- parameter clause: the `QueryClause` to add to the `SectionMonitorChainBuilder`
- returns: a new `SectionMonitorChainBuilder` containing the `QueryClause`
*/
public func appending(_ clause: FetchClause) -> SectionMonitorChainBuilder<D> {
public func appending(_ clause: FetchClause) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: clause)
}
@@ -932,7 +932,7 @@ extension SectionMonitorChainBuilder {
- parameter clauses: the `QueryClause`s to add to the `SectionMonitorChainBuilder`
- returns: a new `SectionMonitorChainBuilder` containing the `QueryClause`s
*/
public func appending<S: Sequence>(contentsOf clauses: S) -> SectionMonitorChainBuilder<D> where S.Element == FetchClause {
public func appending<S: Sequence>(contentsOf clauses: S) -> SectionMonitorChainBuilder<O> where S.Element == FetchClause {
return self.sectionMonitorChain(appending: clauses)
}
@@ -940,7 +940,7 @@ extension SectionMonitorChainBuilder {
// MARK: Private
private func sectionMonitorChain(appending clause: FetchClause) -> SectionMonitorChainBuilder<D> {
private func sectionMonitorChain(appending clause: FetchClause) -> SectionMonitorChainBuilder<O> {
return .init(
from: self.from,
@@ -949,7 +949,7 @@ extension SectionMonitorChainBuilder {
)
}
private func sectionMonitorChain<S: Sequence>(appending clauses: S) -> SectionMonitorChainBuilder<D> where S.Element == FetchClause {
private func sectionMonitorChain<S: Sequence>(appending clauses: S) -> SectionMonitorChainBuilder<O> where S.Element == FetchClause {
return .init(
from: self.from,
@@ -960,10 +960,10 @@ extension SectionMonitorChainBuilder {
}
// MARK: - SectionMonitorChainBuilder where D: CoreStoreObject
// MARK: - SectionMonitorChainBuilder where O: CoreStoreObject
@available(macOS 10.12, *)
extension SectionMonitorChainBuilder where D: CoreStoreObject {
extension SectionMonitorChainBuilder where O: CoreStoreObject {
/**
Adds a `Where` clause to the `SectionMonitorChainBuilder`
@@ -971,8 +971,8 @@ extension SectionMonitorChainBuilder where D: CoreStoreObject {
- parameter clause: a `Where` clause to add to the fetch builder
- returns: a new `SectionMonitorChainBuilder` containing the `Where` clause
*/
public func `where`<T: AnyWhereClause>(_ clause: (D) -> T) -> SectionMonitorChainBuilder<D> {
public func `where`<T: AnyWhereClause>(_ clause: (O) -> T) -> SectionMonitorChainBuilder<O> {
return self.sectionMonitorChain(appending: clause(D.meta))
return self.sectionMonitorChain(appending: clause(O.meta))
}
}