# Where

    public struct Where<D> : WhereClauseType, FetchClause, QueryClause, DeleteClause, Hashable where D : DynamicObject

The `Where` clause specifies the conditions for a fetch or a query.

- `&&(_:_:)`

  Combines two `Where` predicates together using `AND` operator

  #### Declaration

  Swift

      public static func && (left: Where<D>, right: Where<D>) -> Where<D>

- `||(_:_:)`

  Combines two `Where` predicates together using `OR` operator

  #### Declaration

  Swift

      public static func || (left: Where<D>, right: Where<D>) -> Where<D>

- `!(_:)`

  Inverts the predicate of a `Where` clause using `NOT` operator

  #### Declaration

  Swift

      public prefix static func ! (clause: Where<D>) -> Where<D>

- `&&?(_:_:)`

  Combines two `Where` predicates together using `AND` operator.

  #### Declaration

  Swift

      public static func &&? (left: Where<D>, right: Where<D>?) -> Where<D>

  #### Return Value

  `left` if `right` is `nil`, otherwise equivalent to `(left && right)`

- `&&?(_:_:)`

  Combines two `Where` predicates together using `AND` operator.

  #### Declaration

  Swift

      public static func &&? (left: Where<D>?, right: Where<D>) -> Where<D>

  #### Return Value

  `right` if `left` is `nil`, otherwise equivalent to `(left && right)`

- `||?(_:_:)`

  Combines two `Where` predicates together using `OR` operator.

  #### Declaration

  Swift

      public static func ||? (left: Where<D>, right: Where<D>?) -> Where<D>

  #### Return Value

  `left` if `right` is `nil`, otherwise equivalent to `(left || right)`

- `||?(_:_:)`

  Combines two `Where` predicates together using `OR` operator.

  #### Declaration

  Swift

      public static func ||? (left: Where<D>?, right: Where<D>) -> Where<D>

  #### Return Value

  `right` if `left` is `nil`, otherwise equivalent to `(left || right)`

- `init()`

  Initializes a `Where` clause with a predicate that always evaluates to `true`

  #### Declaration

  Swift

      public init()

- `init(_:)`

  Initializes a `Where` clause with an existing `Where` clause.

  #### Declaration

  Swift

      public init(_ clause: Where<D>)

  #### Parameters

  `clause` | the existing `Where` clause.

- `init(_:)`

  Initializes a `Where` clause with a predicate that always evaluates to the specified boolean value

  #### Declaration

  Swift

      public init(_ value: Bool)

  #### Parameters

  `value` | the boolean value for the predicate

- `init(_:_:)`

  Initializes a `Where` clause with a predicate using the specified string format and arguments

  #### Declaration

  Swift

      public init(_ format: String, _ args: Any...)

  #### Parameters

  `format` | the format string for the predicate
  `args` | the arguments for `format`

- `init(_:argumentArray:)`

  Initializes a `Where` clause with a predicate using the specified string format and arguments

  #### Declaration

  Swift

      public init(_ format: String, argumentArray: [Any]?)

  #### Parameters

  `format` | the format string for the predicate
  `argumentArray` | the arguments for `format`

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality to `nil`

  #### Declaration

  Swift

      public init(_ keyPath: KeyPathString, isEqualTo null: Void?)

  #### Parameters

  `keyPath` | the keyPath to compare with
  `null` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<U>(_ keyPath: KeyPathString, isEqualTo value: U?) where U : QueryableAttributeType

  #### Parameters

  `keyPath` | the keyPath to compare with
  `value` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<D>(_ keyPath: KeyPathString, isEqualTo object: D?) where D : DynamicObject

  #### Parameters

  `keyPath` | the keyPath to compare with
  `object` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init(_ keyPath: KeyPathString, isEqualTo objectID: NSManagedObjectID)

  #### Parameters

  `keyPath` | the keyPath to compare with
  `objectID` | the arguments for the `==` operator

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<S>(_ keyPath: KeyPathString, isMemberOf list: S) where S : Sequence, S.Element : QueryableAttributeType

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<S>(_ keyPath: KeyPathString, isMemberOf list: S) where S : Sequence, S.Element : DynamicObject

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<S>(_ keyPath: KeyPathString, isMemberOf list: S) where S : Sequence, S.Element : NSManagedObjectID

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

### AnyWhereClause

- `predicate`

  #### Declaration

  Swift

      public let predicate: NSPredicate

- `init(_:)`

  #### Declaration

  Swift

      public init(_ predicate: NSPredicate)

### WhereClauseType

- `ObjectType`

  #### Declaration

  Swift

      public typealias ObjectType = D

### Equatable

- `==(_:_:)`

  #### Declaration

  Swift

      public static func == (lhs: Where, rhs: Where) -> Bool

### Hashable

- `hash(into:)`

  #### Declaration

  Swift

      public func hash(into hasher: inout Hasher)

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }

### Expression

- `Expression`

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

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

  See more

  #### Declaration

  Swift

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

### SingleTarget

- `SingleTarget`

  Used only for `Where.Expression` type constraints. Specifies that this `Where.Expression` type pertains to an attribute property expression.

  #### Declaration

  Swift

      public enum SingleTarget : WhereExpressionTrait

### CollectionTarget

- `CollectionTarget`

  Used only for `Where.Expression` type constraints. Specifies that this `Where.Expression` type pertains to a to-many relationship expression.

  #### Declaration

  Swift

      public enum CollectionTarget : WhereExpressionTrait

### Where where D: NSManagedObject

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality to `nil`

  #### Declaration

  Swift

      public init<V>(_ keyPath: KeyPath<D, V>, isEqualTo null: Void?) where V : QueryableAttributeType

  #### Parameters

  `keyPath` | the keyPath to compare with
  `null` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality to `nil`

  #### Declaration

  Swift

      public init<O>(_ keyPath: KeyPath<D, O>, isEqualTo null: Void?) where O : DynamicObject

  #### Parameters

  `keyPath` | the keyPath to compare with
  `null` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<V>(_ keyPath: KeyPath<D, V>, isEqualTo value: V?) where V : QueryableAttributeType

  #### Parameters

  `keyPath` | the keyPath to compare with
  `value` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<O>(_ keyPath: KeyPath<D, O>, isEqualTo value: O?) where O : DynamicObject

  #### Parameters

  `keyPath` | the keyPath to compare with
  `value` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<O>(_ keyPath: KeyPath<D, O>, isEqualTo objectID: NSManagedObjectID) where O : DynamicObject

  #### Parameters

  `keyPath` | the keyPath to compare with
  `objectID` | the arguments for the `==` operator

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<V, S>(_ keyPath: KeyPath<D, V>, isMemberOf list: S) where V : QueryableAttributeType, V == S.Element, S : Sequence

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<O, S>(_ keyPath: KeyPath<D, O>, isMemberOf list: S) where O : DynamicObject, O == S.Element, S : Sequence

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<O, S>(_ keyPath: KeyPath<D, O>, isMemberOf list: S) where O : DynamicObject, S : Sequence, S.Element : NSManagedObjectID

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

### Where where D: CoreStoreObject

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality to `nil`

  #### Declaration

  Swift

      public init<V>(_ keyPath: KeyPath<D, ValueContainer<D>.Optional<V>>, isEqualTo null: Void?) where V : ImportableAttributeType

  #### Parameters

  `keyPath` | the keyPath to compare with
  `null` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality to `nil`

  #### Declaration

  Swift

      public init<O>(_ keyPath: KeyPath<D, RelationshipContainer<D>.ToOne<O>>, isEqualTo null: Void?) where O : CoreStoreObject

  #### Parameters

  `keyPath` | the keyPath to compare with
  `null` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<V>(_ keyPath: KeyPath<D, ValueContainer<D>.Required<V>>, isEqualTo value: V?) where V : ImportableAttributeType

  #### Parameters

  `keyPath` | the keyPath to compare with
  `value` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<V>(_ keyPath: KeyPath<D, ValueContainer<D>.Optional<V>>, isEqualTo value: V?) where V : ImportableAttributeType

  #### Parameters

  `keyPath` | the keyPath to compare with
  `value` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<O>(_ keyPath: KeyPath<D, RelationshipContainer<D>.ToOne<O>>, isEqualTo value: O?) where O : CoreStoreObject

  #### Parameters

  `keyPath` | the keyPath to compare with
  `value` | the arguments for the `==` operator

- `init(_:isEqualTo:)`

  Initializes a `Where` clause that compares equality

  #### Declaration

  Swift

      public init<O>(_ keyPath: KeyPath<D, RelationshipContainer<D>.ToOne<O>>, isEqualTo objectID: NSManagedObjectID) where O : CoreStoreObject

  #### Parameters

  `keyPath` | the keyPath to compare with
  `objectID` | the arguments for the `==` operator

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<V, S>(_ keyPath: KeyPath<D, ValueContainer<D>.Required<V>>, isMemberOf list: S) where V : ImportableAttributeType, V == S.Element, S : Sequence

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<V, S>(_ keyPath: KeyPath<D, ValueContainer<D>.Optional<V>>, isMemberOf list: S) where V : ImportableAttributeType, V == S.Element, S : Sequence

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<O, S>(_ keyPath: KeyPath<D, RelationshipContainer<D>.ToOne<O>>, isMemberOf list: S) where O : CoreStoreObject, O == S.Element, S : Sequence

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

- `init(_:isMemberOf:)`

  Initializes a `Where` clause that compares membership

  #### Declaration

  Swift

      public init<O, S>(_ keyPath: KeyPath<D, RelationshipContainer<D>.ToOne<O>>, isMemberOf list: S) where O : CoreStoreObject, S : Sequence, S.Element : NSManagedObjectID

  #### Parameters

  `keyPath` | the keyPath to compare with
  `list` | the sequence to check membership of

- `init(_:)`

  Initializes a `Where` clause from a closure

  #### Declaration

  Swift

      public init(_ condition: (D) -> Where<D>)

  #### Parameters

  `condition` | closure that returns the `Where` clause