QueryChainBuilder

public struct QueryChainBuilder<D, R> : QueryChainableBuilderType where D : 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)
)
  • Adds a Where clause to the QueryChainBuilder

    Declaration

    Swift

    public func `where`(_ clause: Where<D>) -> QueryChainBuilder<D, R>

    Parameters

    clause

    a Where clause to add to the query builder

    Return Value

    a new QueryChainBuilder containing the Where clause

  • Adds a Where clause to the QueryChainBuilder

    Declaration

    Swift

    public func `where`(format: String, _ args: Any...) -> QueryChainBuilder<D, R>

    Parameters

    format

    the format string for the predicate

    args

    the arguments for format

    Return Value

    a new QueryChainBuilder containing the Where clause

  • Adds a Where clause to the QueryChainBuilder

    Declaration

    Swift

    public func `where`(format: String, argumentArray: [Any]?) -> QueryChainBuilder<D, R>

    Parameters

    format

    the format string for the predicate

    argumentArray

    the arguments for format

    Return Value

    a new QueryChainBuilder containing the Where clause

  • Adds an OrderBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func orderBy(_ clause: OrderBy<D>) -> QueryChainBuilder<D, R>

    Parameters

    clause

    the OrderBy clause to add

    Return Value

    a new QueryChainBuilder containing the OrderBy clause

  • Adds an OrderBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func orderBy(_ sortKey: OrderBy<D>.SortKey, _ sortKeys: OrderBy<D>.SortKey...) -> QueryChainBuilder<D, R>

    Parameters

    sortKey

    a single SortKey

    sortKeys

    a series of other SortKeys

    Return Value

    a new QueryChainBuilder containing the OrderBy clause

  • Adds an OrderBy clause to the QueryChainBuild

    Declaration

    Swift

    public func orderBy(_ sortKeys: [OrderBy<D>.SortKey]) -> QueryChainBuilder<D, R>

    Parameters

    sortKeys

    a series of SortKeys

    Return Value

    a new QueryChainBuilder containing the OrderBy clause

  • Adds a Tweak clause to the QueryChainBuilder with a closure where the NSFetchRequest may be configured

    Declaration

    Swift

    public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> QueryChainBuilder<D, R>

    Parameters

    fetchRequest

    the block to customize the NSFetchRequest

    Return Value

    a new QueryChainBuilder containing the Tweak clause

  • Adds a GroupBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func groupBy(_ clause: GroupBy<D>) -> QueryChainBuilder<D, R>

    Parameters

    clause

    a GroupBy clause to add to the query builder

    Return Value

    a new QueryChainBuilder containing the GroupBy clause

  • Adds a GroupBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func groupBy(_ keyPath: KeyPathString, _ keyPaths: KeyPathString...) -> QueryChainBuilder<D, R>

    Parameters

    keyPath

    a key path to group the query results with

    keyPaths

    other key paths to group the query results with

    Return Value

    a new QueryChainBuilder containing the GroupBy clause

  • Adds a GroupBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func groupBy(_ keyPaths: [KeyPathString]) -> QueryChainBuilder<D, R>

    Parameters

    keyPaths

    a series of key paths to group the query results with

    Return Value

    a new QueryChainBuilder containing the GroupBy clause

  • Appends a QueryClause to the QueryChainBuilder

    Declaration

    Swift

    public func appending(_ clause: QueryClause) -> QueryChainBuilder<D, R>

    Parameters

    clause

    the QueryClause to add to the QueryChainBuilder

    Return Value

    a new QueryChainBuilder containing the QueryClause

  • Appends a series of QueryClauses to the QueryChainBuilder

    Declaration

    Swift

    public func appending<S>(contentsOf clauses: S) -> QueryChainBuilder<D, R> where S : Sequence, S.Element == QueryClause

    Parameters

    clauses

    the QueryClauses to add to the QueryChainBuilder

    Return Value

    a new QueryChainBuilder containing the QueryClauses

  • Adds a GroupBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func groupBy<T>(_ keyPath: KeyPath<D, T>) -> QueryChainBuilder<D, R>

    Parameters

    keyPath

    a key path to group the query results with

    Return Value

    a new QueryChainBuilder containing the GroupBy clause

  • Adds a Where clause to the QueryChainBuilder

    Declaration

    Swift

    public func `where`<T>(_ clause: (D) -> T) -> QueryChainBuilder<D, R> where T : AnyWhereClause

    Parameters

    clause

    a Where clause to add to the query builder

    Return Value

    a new QueryChainBuilder containing the Where clause

  • Adds a GroupBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func groupBy<T>(_ keyPath: KeyPath<D, ValueContainer<D>.Required<T>>) -> QueryChainBuilder<D, R> where T : ImportableAttributeType

    Parameters

    keyPath

    a key path to group the query results with

    Return Value

    a new QueryChainBuilder containing the GroupBy clause

  • Adds a GroupBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func groupBy<T>(_ keyPath: KeyPath<D, ValueContainer<D>.Optional<T>>) -> QueryChainBuilder<D, R> where T : ImportableAttributeType

    Parameters

    keyPath

    a key path to group the query results with

    Return Value

    a new QueryChainBuilder containing the GroupBy clause

  • Adds a GroupBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func groupBy<T>(_ keyPath: KeyPath<D, TransformableContainer<D>.Required<T>>) -> QueryChainBuilder<D, R> where T : NSCoding, T : NSCopying

    Parameters

    keyPath

    a key path to group the query results with

    Return Value

    a new QueryChainBuilder containing the GroupBy clause

  • Adds a GroupBy clause to the QueryChainBuilder

    Declaration

    Swift

    public func groupBy<T>(_ keyPath: KeyPath<D, TransformableContainer<D>.Optional<T>>) -> QueryChainBuilder<D, R> where T : NSCoding, T : NSCopying

    Parameters

    keyPath

    a key path to group the query results with

    Return Value

    a new QueryChainBuilder containing the GroupBy clause