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:
  • for queryAttributes(...) methods:

    • NSDictionary
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Declaration

    Swift

    public var debugDescription: String { get }
  • Initializes a Select that queries for NSManagedObjectID results

    Declaration

    Swift

    public 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

  • 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

  • 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

  • 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

  • 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