mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-22 01:19:16 +01:00
keyPath utilities for SectionBy clauses
This commit is contained in:
@@ -51,7 +51,7 @@ public protocol SectionMonitorBuilderType {
|
||||
associatedtype ObjectType: DynamicObject
|
||||
|
||||
var from: From<ObjectType> { get set }
|
||||
var sectionBy: SectionBy { get set }
|
||||
var sectionBy: SectionBy<ObjectType> { get set }
|
||||
var fetchClauses: [FetchClause] { get set }
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public struct SectionMonitorChainBuilder<D: DynamicObject>: SectionMonitorBuilde
|
||||
// MARK: SectionMonitorBuilderType
|
||||
|
||||
public var from: From<D>
|
||||
public var sectionBy: SectionBy
|
||||
public var sectionBy: SectionBy<D>
|
||||
public var fetchClauses: [FetchClause] = []
|
||||
}
|
||||
|
||||
@@ -101,6 +101,15 @@ public struct SectionMonitorChainBuilder<D: DynamicObject>: SectionMonitorBuilde
|
||||
|
||||
public extension From {
|
||||
|
||||
public func select<R>(_ clause: Select<D, R>) -> QueryChainBuilder<D, R> {
|
||||
|
||||
return .init(
|
||||
from: self,
|
||||
select: clause,
|
||||
queryClauses: []
|
||||
)
|
||||
}
|
||||
|
||||
public func select<R>(_ resultType: R.Type, _ selectTerm: SelectTerm<D>, _ selectTerms: SelectTerm<D>...) -> QueryChainBuilder<D, R> {
|
||||
|
||||
return self.select(resultType, [selectTerm] + selectTerms)
|
||||
@@ -115,6 +124,16 @@ public extension From {
|
||||
)
|
||||
}
|
||||
|
||||
@available(OSX 10.12, *)
|
||||
public func sectionBy(_ clause: SectionBy<D>) -> SectionMonitorChainBuilder<D> {
|
||||
|
||||
return .init(
|
||||
from: self,
|
||||
sectionBy: clause,
|
||||
fetchClauses: []
|
||||
)
|
||||
}
|
||||
|
||||
@available(OSX 10.12, *)
|
||||
public func sectionBy(_ sectionKeyPath: KeyPathString) -> SectionMonitorChainBuilder<D> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user