QueryChainBuilder
public struct QueryChainBuilder<O, R> : QueryChainableBuilderType where O : DynamicObject, R : SelectResultType
The fetch builder type used for a queries. A QueryChainBuilder is created from a From clause and then a select(...) chain.
let averageAdultAge = dataStack.queryValue(
From<MyPersonEntity>()
.select(Int.self, .average(\.age))
.where(\.age > 18)
)
-
Declaration
Swift
public typealias ObjectType = O -
Declaration
Swift
public typealias ResultType = R -
Declaration
Swift
public var from: From<O> -
Declaration
Swift
public var select: Select<O, R> -
Declaration
Swift
public var queryClauses: [QueryClause]
-
Creates a
FetchChainBuilderthatANDs the specifiedWhereclauses. Use this overload if the compiler cannot infer the types when chaining multiple&&operators.Declaration
Swift
public func `where`(combineByAnd clauses: Where<O>...) -> QueryChainBuilder<O, R>Parameters
clausesthe
Whereclauses to create aFetchChainBuilderwithReturn Value
a
FetchChainBuilderthatANDs the specifiedWhereclauses -
Creates a
FetchChainBuilderthatORs the specifiedWhereclauses. Use this overload if the compiler cannot infer the types when chaining multiple||operators.Declaration
Swift
public func `where`(combineByOr clauses: Where<O>...) -> QueryChainBuilder<O, R>Parameters
clausesthe
Whereclauses to create aFetchChainBuilderwithReturn Value
a
FetchChainBuilderthatORs the specifiedWhereclauses -
Adds a
Whereclause to theQueryChainBuilderDeclaration
Swift
public func `where`(format: String, argumentArray: [Any]?) -> QueryChainBuilder<O, R>Parameters
formatthe format string for the predicate
argumentArraythe arguments for
formatReturn Value
a new
QueryChainBuildercontaining theWhereclause -
Adds a
Tweakclause to theQueryChainBuilderwith a closure where theNSFetchRequestmay be configuredDeclaration
Swift
public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> QueryChainBuilder<O, R>Parameters
fetchRequestthe block to customize the
NSFetchRequestReturn Value
a new
QueryChainBuildercontaining theTweakclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy(_ keyPath: KeyPathString, _ keyPaths: KeyPathString...) -> QueryChainBuilder<O, R>Parameters
keyPatha key path to group the query results with
keyPathsother key paths to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy(_ keyPaths: [KeyPathString]) -> QueryChainBuilder<O, R>Parameters
keyPathsa series of key paths to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause -
Appends a
QueryClauseto theQueryChainBuilderDeclaration
Swift
public func appending(_ clause: QueryClause) -> QueryChainBuilder<O, R>Parameters
clausethe
QueryClauseto add to theQueryChainBuilderReturn Value
a new
QueryChainBuildercontaining theQueryClause -
Appends a series of
QueryClauses to theQueryChainBuilderDeclaration
Swift
public func appending<S>(contentsOf clauses: S) -> QueryChainBuilder<O, R> where S : Sequence, S.Element == QueryClauseParameters
clausesthe
QueryClauses to add to theQueryChainBuilderReturn Value
a new
QueryChainBuildercontaining theQueryClauses
-
Adds a
Whereclause to theQueryChainBuilderDeclaration
Swift
public func `where`<T>(_ clause: (O) -> T) -> QueryChainBuilder<O, R> where T : AnyWhereClauseParameters
clausea
Whereclause to add to the query builderReturn Value
a new
QueryChainBuildercontaining theWhereclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy<T>(_ keyPath: KeyPath<O, FieldContainer<O>.Stored<T>>) -> QueryChainBuilder<O, R> where T : FieldStorableTypeParameters
keyPatha key path to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy<T>(_ keyPath: KeyPath<O, FieldContainer<O>.Virtual<T>>) -> QueryChainBuilder<O, R>Parameters
keyPatha key path to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy<T>(_ keyPath: KeyPath<O, FieldContainer<O>.Coded<T>>) -> QueryChainBuilder<O, R>Parameters
keyPatha key path to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy<T>(_ keyPath: KeyPath<O, ValueContainer<O>.Required<T>>) -> QueryChainBuilder<O, R> where T : ImportableAttributeTypeParameters
keyPatha key path to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy<T>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<T>>) -> QueryChainBuilder<O, R> where T : ImportableAttributeTypeParameters
keyPatha key path to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy<T>(_ keyPath: KeyPath<O, TransformableContainer<O>.Required<T>>) -> QueryChainBuilder<O, R> where T : NSCoding, T : NSCopyingParameters
keyPatha key path to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause -
Adds a
GroupByclause to theQueryChainBuilderDeclaration
Swift
public func groupBy<T>(_ keyPath: KeyPath<O, TransformableContainer<O>.Optional<T>>) -> QueryChainBuilder<O, R> where T : NSCoding, T : NSCopyingParameters
keyPatha key path to group the query results with
Return Value
a new
QueryChainBuildercontaining theGroupByclause
View on GitHub
QueryChainBuilder Structure Reference