Expression

public struct Expression<T, V> : CustomStringConvertible, KeyPathStringConvertible where T : WhereExpressionTrait

Type-safe keyPath chain usable in query/fetch expressions.

let expression: Where<Pet>.Expression = (\.master ~ \.name)
let owner = dataStack.fetchOne(
   From<Pet>().where(expression == "John")
)

AnyKeyPathStringConvertible

KeyPathStringConvertible

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }

Available where O: NSManagedObject, T == Where<O>.CollectionTarget, V: AllowedObjectiveCToManyRelationshipKeyPathValue

  • Creates a Where.Expression clause for COUNT

    let dogsWithPlaymates = dataStack.fetchAll(From<Dog>().where((\.master ~ \.pets).count() > 1))
    

    Declaration

    Swift

    public func count() -> Where<O>.Expression<T, Int>

Available where O: NSManagedObject, T == Where<O>.CollectionTarget, V: AllowedObjectiveCKeyPathValue

  • Creates a Where.Expression clause for ANY

    let dogsWithBadNamingSense = dataStack.fetchAll(From<Dog>().where((\.master ~ \.pets ~ \.name).any() > "Spot"))
    

    Declaration

    Swift

    public func any() -> Where<O>.Expression<T, V>
  • Creates a Where.Expression clause for ALL

    let allPlaymatePuppies = dataStack.fetchAll(From<Dog>().where((\.master ~ \.pets ~ \.age).all() > 5))
    

    Declaration

    Swift

    public func all() -> Where<O>.Expression<T, V>
  • Creates a Where.Expression clause for NONE

    let dogs = dataStack.fetchAll(From<Dog>().where((\.master ~ \.pets ~ \.name).any() > "Spot"))
    

    Declaration

    Swift

    public func none() -> Where<O>.Expression<T, V>

Available where O: CoreStoreObject, T == Where<O>.CollectionTarget

  • Creates a Where.Expression clause for COUNT

    let dogsWithPlaymates = dataStack.fetchAll(From<Dog>().where((\.master ~ \.pets).count() > 1))
    

    Declaration

    Swift

    public func count() -> Where<O>.Expression<T, Int>
  • Creates a Where.Expression clause for ANY

    let dogsWithBadNamingSense = dataStack.fetchAll(From<Dog>().where((\.master ~ \.pets ~ \.name).any() > "Spot"))
    

    Declaration

    Swift

    public func any() -> Where<O>.Expression<T, V>
  • Creates a Where.Expression clause for ALL

    let allPlaymatePuppies = dataStack.fetchAll(From<Dog>().where((\.master ~ \.pets ~ \.age).all() > 5))
    

    Declaration

    Swift

    public func all() -> Where<O>.Expression<T, V>
  • Creates a Where.Expression clause for NONE

    let dogs = dataStack.fetchAll(From<Dog>().where((\.master ~ \.pets ~ \.name).any() > "Spot"))
    

    Declaration

    Swift

    public func none() -> Where<O>.Expression<T, V>