# 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")
    )

- `Trait`

  Currently supports `SingleTarget` and `CollectionTarget`.

  #### Declaration

  Swift

      public typealias Trait = T

### AnyKeyPathStringConvertible

- `cs_keyPathString`

  #### Declaration

  Swift

      public let cs_keyPathString: String

### KeyPathStringConvertible

- `ObjectType`

  #### Declaration

  Swift

      public typealias ObjectType = O

- `DestinationValueType`

  #### Declaration

  Swift

      public typealias DestinationValueType = V

### CustomStringConvertible

- `description`

  #### Declaration

  Swift

      public var description: String { get }

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

- `count()`

  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`

- `any()`

  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>

- `all()`

  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>

- `none()`

  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`

- `count()`

  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>

- `any()`

  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>

- `all()`

  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>

- `none()`

  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>