# FetchChainBuilder

    public struct FetchChainBuilder<D> : FetchChainableBuilderType where D : DynamicObject

The fetch builder type used for fetches. A `FetchChainBuilder` is created from a `From` clause.

    let people = source.fetchAll(
        From<MyPersonEntity>()
            .where(\.age > 18)
            .orderBy(.ascending(\.age))
    )

### FetchChainableBuilderType

- `ObjectType`

  #### Declaration

  Swift

      public typealias ObjectType = D

- `from`

  #### Declaration

  Swift

      public var from: From<D>

- `fetchClauses`

  #### Declaration

  Swift

      public var fetchClauses: [FetchClause]

### FetchChainBuilder

- `where(_:)`

  Adds a `Where` clause to the `FetchChainBuilder`

  #### Declaration

  Swift

      public func `where`(_ clause: Where<D>) -> FetchChainBuilder<D>

  #### Parameters

  `clause` | a `Where` clause to add to the fetch builder

  #### Return Value

  a new `FetchChainBuilder` containing the `Where` clause

- `where(format:_:)`

  Adds a `Where` clause to the `FetchChainBuilder`

  #### Declaration

  Swift

      public func `where`(format: String, _ args: Any...) -> FetchChainBuilder<D>

  #### Parameters

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

  #### Return Value

  a new `FetchChainBuilder` containing the `Where` clause

- `where(format:argumentArray:)`

  Adds a `Where` clause to the `FetchChainBuilder`

  #### Declaration

  Swift

      public func `where`(format: String, argumentArray: [Any]?) -> FetchChainBuilder<D>

  #### Parameters

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

  #### Return Value

  a new `FetchChainBuilder` containing the `Where` clause

- `orderBy(_:)`

  Adds an `OrderBy` clause to the `FetchChainBuilder`

  #### Declaration

  Swift

      public func orderBy(_ clause: OrderBy<D>) -> FetchChainBuilder<D>

  #### Parameters

  `clause` | the `OrderBy` clause to add

  #### Return Value

  a new `FetchChainBuilder` containing the `OrderBy` clause

- `orderBy(_:_:)`

  Adds an `OrderBy` clause to the `FetchChainBuilder`

  #### Declaration

  Swift

      public func orderBy(_ sortKey: OrderBy<D>.SortKey, _ sortKeys: OrderBy<D>.SortKey...) -> FetchChainBuilder<D>

  #### Parameters

  `sortKey` | a single `SortKey`
  `sortKeys` | a series of other `SortKey`s

  #### Return Value

  a new `FetchChainBuilder` containing the `OrderBy` clause

- `orderBy(_:)`

  Adds an `OrderBy` clause to the `FetchChainBuilder`

  #### Declaration

  Swift

      public func orderBy(_ sortKeys: [OrderBy<D>.SortKey]) -> FetchChainBuilder<D>

  #### Parameters

  `sortKeys` | a series of `SortKey`s

  #### Return Value

  a new `FetchChainBuilder` containing the `OrderBy` clause

- `tweak(_:)`

  Adds a `Tweak` clause to the `FetchChainBuilder` with a closure where the `NSFetchRequest` may be configured

  #### Declaration

  Swift

      public func tweak(_ fetchRequest: @escaping (NSFetchRequest<NSFetchRequestResult>) -> Void) -> FetchChainBuilder<D>

  #### Parameters

  `fetchRequest` | the block to customize the `NSFetchRequest`

  #### Return Value

  a new `FetchChainBuilder` containing the `Tweak` clause

- `appending(_:)`

  Appends a `FetchClause` to the `FetchChainBuilder`

  #### Declaration

  Swift

      public func appending(_ clause: FetchClause) -> FetchChainBuilder<D>

  #### Parameters

  `clause` | the `FetchClause` to add to the `FetchChainBuilder`

  #### Return Value

  a new `FetchChainBuilder` containing the `FetchClause`

- `appending(contentsOf:)`

  Appends a series of `FetchClause`s to the `FetchChainBuilder`

  #### Declaration

  Swift

      public func appending<S>(contentsOf clauses: S) -> FetchChainBuilder<D> where S : Sequence, S.Element == FetchClause

  #### Parameters

  `clauses` | the `FetchClause`s to add to the `FetchChainBuilder`

  #### Return Value

  a new `FetchChainBuilder` containing the `FetchClause`s