PropertyAlias

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

As a convenience, you can register a short name (called an alias) for a query condition, and later modify its values.

Example of the operator in the block-based syntax:

let query1 = personBox.query { "AgeRestriction" .= Person.age > 21 }
let query2 = personBox.query { "AgeRestriction" .= Person.age > 18 }
query1.setParameter("AgeRestriction", to: 18)
// Now query1 and query2 produce the same results

Currently, aliases do not work for non-block-based queries.

Note

setParameter does not perform type checks for you. Do not use a String variant for an integer parameter.
  • Entity type that contains the property this query is aliasing.

    Declaration

    Swift

    public typealias EntityType = E
  • Supported property value type this alias is describing.

    Declaration

    Swift

    public typealias ValueType = T
  • The short name.

    Declaration

    Swift

    public let alias: String