# Select

    public struct Select<D, T> : SelectClause, Hashable where D : DynamicObject, T : SelectResultType

The `Select` clause indicates the attribute / aggregate value to be queried. The generic type is a `SelectResultType`, and will be used as the return type for the query.

You can bind the return type by specializing the initializer:

    let maximumAge = CoreStore.queryValue(
        From<MyPersonEntity>(),
        Select<Int>(.maximum("age"))
    )

or by casting the type of the return value:

    let maximumAge: Int = CoreStore.queryValue(
        From<MyPersonEntity>(),
        Select(.maximum("age"))
    )

Valid return types depend on the query:

- for `queryValue(...)` methods:
  - all types that conform to `QueryableAttributeType` protocol

- for `queryAttributes(...)` methods:

  - `NSDictionary`

- `init(_:_:)`

  Initializes a `Select` clause with a list of `SelectTerm`s

  #### Declaration

  Swift

      public init(_ selectTerm: SelectTerm<D>, _ selectTerms: SelectTerm<D>...)

  #### Parameters

  `selectTerm` | a `SelectTerm`
  `selectTerms` | a series of `SelectTerm`s

- `init(_:)`

  Initializes a `Select` clause with a list of `SelectTerm`s

  #### Declaration

  Swift

      public init(_ selectTerms: [SelectTerm<D>])

  #### Parameters

  `selectTerms` | a series of `SelectTerm`s

### Equatable

- `==(_:_:)`

  #### Declaration

  Swift

      public static func == <T, U>(lhs: Select<D, T>, rhs: Select<D, U>) -> Bool where T : SelectResultType, U : SelectResultType

### SelectClause

- `ObjectType`

  #### Declaration

  Swift

      public typealias ObjectType = D

- `ReturnType`

  #### Declaration

  Swift

      public typealias ReturnType = T

- `selectTerms`

  #### Declaration

  Swift

      public let selectTerms: [SelectTerm<D>]

### Hashable

- `hash(into:)`

  #### Declaration

  Swift

      public func hash(into hasher: inout Hasher)

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }

### Select

- `init()`

  Initializes a `Select` that queries for `NSManagedObjectID` results

  #### Declaration

  Swift

      public init()

### Select

- `init(_:)`

  Initializes a `Select` that queries the value of an attribute pertained by a keyPath

  #### Declaration

  Swift

      public init(_ keyPath: KeyPath<D, T>)

  #### Parameters

  `keyPath` | the keyPath for the attribute

### Select

- `init(_:)`

  Initializes a `Select` that queries the value of an attribute pertained by a keyPath

  #### Declaration

  Swift

      public init(_ keyPath: KeyPath<D, ValueContainer<D>.Required<T>>)

  #### Parameters

  `keyPath` | the keyPath for the attribute

- `init(_:)`

  Initializes a `Select` that queries the value of an attribute pertained by a keyPath

  #### Declaration

  Swift

      public init(_ keyPath: KeyPath<D, ValueContainer<D>.Optional<T>>)

  #### Parameters

  `keyPath` | the keyPath for the attribute

### Select

- `init(_:)`

  Initializes a `Select` that queries the value of an attribute pertained by a keyPath

  #### Declaration

  Swift

      public init(_ keyPath: KeyPath<D, TransformableContainer<D>.Required<T>>)

  #### Parameters

  `keyPath` | the keyPath for the attribute

- `init(_:)`

  Initializes a `Select` that queries the value of an attribute pertained by a keyPath

  #### Declaration

  Swift

      public init(_ keyPath: KeyPath<D, TransformableContainer<D>.Optional<T>>)

  #### Parameters

  `keyPath` | the keyPath for the attribute