QueryBuilder

public final class QueryBuilder<E: EntityInspectable & __EntityRelatable>
where E == E.EntityBindingType.EntityType

An object that describes a query. You usually interact with a QueryBuilder solely via Box’s query() method, but certain properties that can’t be modified on a query once it has been built (like sort order) can be configured on the QueryBuilder. Call build() on a QueryBuilder to create an actual query object that you can request objects from.

  • Undocumented

    Declaration

    Swift

    public typealias EntityType = E
  • Build a query from the information in this query builder, which can then be used to get actual query results from the database.

    Declaration

    Swift

    public func build() -> Query<EntityType>
  • Request that query results for an entity query be returned sorted by the given property. Can not be called after the query has been used the first time. Currently has no effect on the result of calling query.property(…).

    Declaration

    Swift

    public func ordered<T>(by property: Property<EntityType, T>, flags: OBXOrderFlags = [])
        -> QueryBuilder<EntityType>

    Parameters

    property

    The property by which to sort.

    flags

    Additional flags to control sort behaviour, like what to do with NIL values, or to sort descending instead of ascending.