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.

  • 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

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

    a SelectTerm to a Select clause for a count query

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

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

  • 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

Equatable

  • Declaration

    Swift

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

Hashable

  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)

CustomDebugStringConvertible

  • Declaration

    Swift

    public var debugDescription: String { get }

Available where O: NSManagedObject

  • 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

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

    a SelectTerm to a Select clause for a count query

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

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

Available where O: CoreStoreObject

  • 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

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

    a SelectTerm to a Select clause for a count query

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

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

  • 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()” is used

    Return Value

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