PropertyQueryCondition

public class PropertyQueryCondition<E, T> : QueryCondition<E> where E : Entity, T : EntityPropertyTypeConvertible

Representation of comparison expression conditions of a Query.

All operators that target entity properties will produce this:

personBox.query { Person.age > 21 }

You can apply a short name (called alias, see PropertyAlias) to later identify specific expressions using the .= operator. This is useful to change the values. The example above with an alias would read:

let query = personBox.query { AgeRestriction .= Person.age > 21 } // Change the condition to Person.age > 18 query.setParameter(AgeRestriction, to: 18)

You can form conditions and use them later, like:

let alcoholRestriction: QueryCondition<Person> =
       "MinAge" .= Person.age > 21
    && "MaxAge" .= Person.age < 80
// ...
let alcoholAllowedQuery = personBox.query {
    return alcoholRestriction
        || (Person.firstName == "Johnny" && Person.lastName == "Walker")
}
alcoholAllowedQuery.setParameter("MinAge", to: 18)
  • Entity type that contains the property this query condition is describing.

    Declaration

    Swift

    public typealias EntityType = E
  • Supported property value query condition this is describing.

    Declaration

    Swift

    public typealias ValueType = T