Select

public struct Select<O, T> : SelectClause, Hashable where O : DynamicObject, T : SelectResultType
extension Select: CustomDebugStringConvertible, CoreStoreDebugStringConvertible

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 = dataStack.queryValue(
    From<MyPersonEntity>(),
    Select<Int>(.maximum("age"))
)

or by casting the type of the return value:

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

Valid return types depend on the query:

  • for queryValue(...) methods:
  • for queryAttributes(...) methods:

    • NSDictionary

Parameters

sortDescriptors

a series of NSSortDescriptors

Equatable

SelectClause

Hashable

  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)

CustomDebugStringConvertible

  • Declaration

    Swift

    public var debugDescription: String { get }

Available where T: NSManagedObjectID

  • Initializes a Select that queries for NSManagedObjectID results

    Declaration

    Swift

    public init()

Available where O: NSManagedObject

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

    Declaration

    Swift

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

    Parameters

    keyPath

    the keyPath for the attribute

Available where O: CoreStoreObject, T: ImportableAttributeType

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

    Declaration

    Swift

    public init(_ keyPath: KeyPath<O, ValueContainer<O>.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<O, ValueContainer<O>.Optional<T>>)

    Parameters

    keyPath

    the keyPath for the attribute

Available where O: CoreStoreObject, T: ImportableAttributeType & NSCoding & NSCopying

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

    Declaration

    Swift

    public init(_ keyPath: KeyPath<O, TransformableContainer<O>.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<O, TransformableContainer<O>.Optional<T>>)

    Parameters

    keyPath

    the keyPath for the attribute