# SelectTerm

    public enum SelectTerm<O> : ExpressibleByStringLiteral, Hashable where O : DynamicObject

    extension SelectTerm: CustomDebugStringConvertible, CoreStoreDebugStringConvertible

The `SelectTerm` is passed to the `Select` clause to indicate the attributes/aggregate keys to be queried.

- `attribute(_:)`

  Provides a `SelectTerm` to a `Select` clause for querying an entity attribute. A shorter way to do the same is to assign from the string keypath directly:

      let fullName = dataStack.queryValue(
          From<MyPersonEntity>(),
          Select<String>(.attribute("fullName")),
          Where("employeeID", isEqualTo: 1111)
      )

  is equivalent to:

      let fullName = dataStack.queryValue(
          From<MyPersonEntity>(),
          Select<String>("fullName"),
          Where("employeeID", isEqualTo: 1111)
      )

  #### Declaration

  Swift

      public static func attribute(_ keyPath: KeyPathString) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying an entity attribute

- `average(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the average value of an attribute.

      let averageAge = dataStack.queryValue(
          From<MyPersonEntity>(),
          Select<Int>(.average("age"))
      )

  #### Declaration

  Swift

      public static func average(_ keyPath: KeyPathString, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “average(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the average value of an attribute

- `count(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for a count query.

      let numberOfEmployees = dataStack.queryValue(
          From<MyPersonEntity>(),
          Select<Int>(.count("employeeID"))
      )

  #### Declaration

  Swift

      public static func count(_ keyPath: KeyPathString, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “count(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for a count query

- `maximum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute.

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

  #### Declaration

  Swift

      public static func maximum(_ keyPath: KeyPathString, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “max(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute

- `minimum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute.

      let minimumAge = dataStack.queryValue(
          From<MyPersonEntity>(),
          Select<Int>(.minimum("age"))
      )

  #### Declaration

  Swift

      public static func minimum(_ keyPath: KeyPathString, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “min(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute

- `sum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the sum value for an attribute.

      let totalAge = dataStack.queryValue(
          From<MyPersonEntity>(),
          Select<Int>(.sum("age"))
      )

  #### Declaration

  Swift

      public static func sum(_ keyPath: KeyPathString, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “sum(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the sum value for an attribute

- `objectID(as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the `NSManagedObjectID`.

      let objectID = dataStack.queryValue(
          From<MyPersonEntity>(),
          Select<NSManagedObjectID>(),
          Where("employeeID", isEqualTo: 1111)
      )

  #### Declaration

  Swift

      public static func objectID(as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “objecID” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the sum value for an attribute

### ExpressibleByStringLiteral

- `init(stringLiteral:)`

  #### Declaration

  Swift

      public init(stringLiteral value: KeyPathString)

- `init(unicodeScalarLiteral:)`

  #### Declaration

  Swift

      public init(unicodeScalarLiteral value: KeyPathString)

- `init(extendedGraphemeClusterLiteral:)`

  #### Declaration

  Swift

      public init(extendedGraphemeClusterLiteral value: KeyPathString)

### Equatable

- `==(_:_:)`

  #### Declaration

  Swift

      public static func == (lhs: SelectTerm<O>, rhs: SelectTerm<O>) -> Bool

### Hashable

- `hash(into:)`

  #### Declaration

  Swift

      public func hash(into hasher: inout Hasher)

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }

### Available where `O`: `NSManagedObject`

- `attribute(_:)`

  Provides a `SelectTerm` to a `Select` clause for querying an entity attribute.

  #### Declaration

  Swift

      public static func attribute<V>(_ keyPath: KeyPath<O, V>) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying an entity attribute

- `average(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the average value of an attribute.

  #### Declaration

  Swift

      public static func average<V>(_ keyPath: KeyPath<O, V>, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “average(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the average value of an attribute

- `count(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for a count query.

  #### Declaration

  Swift

      public static func count<V>(_ keyPath: KeyPath<O, V>, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “count(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for a count query

- `maximum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute.

  #### Declaration

  Swift

      public static func maximum<V>(_ keyPath: KeyPath<O, V>, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “max(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute

- `minimum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute.

  #### Declaration

  Swift

      public static func minimum<V>(_ keyPath: KeyPath<O, V>, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “min(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute

- `sum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the sum value for an attribute.

  #### Declaration

  Swift

      public static func sum<V>(_ keyPath: KeyPath<O, V>, as alias: KeyPathString? = nil) -> SelectTerm<O>

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “sum(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the sum value for an attribute

### Available where `O`: `CoreStoreObject`

- `attribute(_:)`

  Provides a `SelectTerm` to a `Select` clause for querying an entity attribute.

  #### Declaration

  Swift

      public static func attribute<K>(_ keyPath: KeyPath<O, K>) -> SelectTerm<O> where O == K.ObjectType, K : AttributeKeyPathStringConvertible

  #### Parameters

  `keyPath` | the attribute name

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying an entity attribute

- `average(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the average value of an attribute.

  #### Declaration

  Swift

      public static func average<K>(_ keyPath: KeyPath<O, K>, as alias: KeyPathString? = nil) -> SelectTerm<O> where O == K.ObjectType, K : AttributeKeyPathStringConvertible

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “average(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the average value of an attribute

- `count(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for a count query.

  #### Declaration

  Swift

      public static func count<K: AttributeKeyPathStringConvertible>(_ keyPath: KeyPath<O,
          K>, as alias: KeyPathString? = nil) -> SelectTerm<O> where K.ObjectType == O

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “count(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for a count query

- `maximum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute.

  #### Declaration

  Swift

      public static func maximum<K: AttributeKeyPathStringConvertible>(_ keyPath: KeyPath<O,
          K>, as alias: KeyPathString? = nil) -> SelectTerm<O> where K.ObjectType == O

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “max(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute

- `minimum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute.

  #### Declaration

  Swift

      public static func minimum<K>(_ keyPath: KeyPath<O, K>, as alias: KeyPathString? = nil) -> SelectTerm<O> where O == K.ObjectType, K : AttributeKeyPathStringConvertible

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “min(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute

- `sum(_:as:)`

  Provides a `SelectTerm` to a `Select` clause for querying the sum value for an attribute.

  #### Declaration

  Swift

      public static func sum<K>(_ keyPath: KeyPath<O, K>, as alias: KeyPathString? = nil) -> SelectTerm<O> where O == K.ObjectType, K : AttributeKeyPathStringConvertible

  #### Parameters

  `keyPath` | the attribute name
  `alias` | the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key “sum(<attributeName>)” is used

  #### Return Value

  a `SelectTerm` to a `Select` clause for querying the sum value for an attribute