PropertyAlias

public class PropertyAlias<E: EntityInspectable & __EntityRelatable, T: EntityPropertyTypeConvertible>:
    QueryCondition<E>
where E == E.EntityBindingType.EntityType

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 = try personBox.query { "AgeRestriction" .= Person.age > 21 }.build()
let query2 = try personBox.query { "AgeRestriction" .= Person.age > 18 }.build()
try 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