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
- all types that conform to
for
queryAttributes(...)
methods:NSDictionary
-
Initializes a
Select
clause with a list ofSelectTerm
sDeclaration
Swift
public init(_ selectTerm: SelectTerm<D>, _ selectTerms: SelectTerm<D>...)
Parameters
selectTerm
selectTerms
a series of
SelectTerm
s -
Initializes a
Select
clause with a list ofSelectTerm
sDeclaration
Swift
public init(_ selectTerms: [SelectTerm<D>])
Parameters
selectTerms
a series of
SelectTerm
s
-
Declaration
Swift
public static func == <T, U>(lhs: Select<D, T>, rhs: Select<D, U>) -> Bool where T : SelectResultType, U : SelectResultType
-
Declaration
Swift
public typealias ObjectType = D
-
Declaration
Swift
public typealias ReturnType = T
-
Declaration
Swift
public let selectTerms: [SelectTerm<D>]
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Declaration
Swift
public var debugDescription: String { get }
-
Initializes a
Select
that queries forNSManagedObjectID
resultsDeclaration
Swift
public init()
-
Initializes a
Select
that queries the value of an attribute pertained by a keyPathDeclaration
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 keyPathDeclaration
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 keyPathDeclaration
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 keyPathDeclaration
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 keyPathDeclaration
Swift
public init(_ keyPath: KeyPath<D, TransformableContainer<D>.Optional<T>>)
Parameters
keyPath
the keyPath for the attribute