CSSelectTerm
@objc
public final class CSSelectTerm : NSObject
The CSSelectTerm
serves as the Objective-C bridging type for SelectTerm
.
See also
SelectTerm
-
Provides a
CSSelectTerm
to aCSSelect
clause for querying an entity attribute.NSString *fullName = [CSCoreStore queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:CSSelectString(CSAttribute(@"fullname")) fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]];
Declaration
Swift
@objc public convenience init(keyPath: KeyPathString)
Parameters
keyPath
the attribute name
-
Provides a
CSSelectTerm
to aCSSelect
clause for querying the average value of an attribute.NSNumber *averageAge = [CSCoreStore queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm average:@"age" as:nil]]];
Declaration
Swift
@objc public static func average(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm
Parameters
keyPath
the attribute name
Return Value
a
CSSelectTerm
to aCSSelect
clause for querying the average value of an attribute -
Provides a
CSSelectTerm
to aCSSelect
clause for a count query.NSNumber *numberOfEmployees = [CSCoreStore queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm count:@"employeeID" as:nil]]];
Declaration
Swift
@objc public static func count(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm
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
. Ifnil
, the default keycount(
is used) Return Value
a
SelectTerm
to aSelect
clause for a count query -
Provides a
CSSelectTerm
to aCSSelect
clause for querying the maximum value for an attribute.NSNumber *maximumAge = [CSCoreStore queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm maximum:@"age" as:nil]]];
Declaration
Swift
@objc public static func maximum(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm
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
. Ifnil
, the default keymax(
is used) Return Value
a
CSSelectTerm
to aCSSelect
clause for querying the maximum value for an attribute -
Provides a
CSSelectTerm
to aCSSelect
clause for querying the minimum value for an attribute.NSNumber *minimumAge = [CSCoreStore queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm minimum:@"age" as:nil]]];
Declaration
Swift
@objc public static func minimum(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm
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
. Ifnil
, the default keymin(
is used) Return Value
a
CSSelectTerm
to aCSSelect
clause for querying the minimum value for an attribute -
Provides a
CSSelectTerm
to aCSSelect
clause for querying the sum value for an attribute.NSNumber *totalAge = [CSCoreStore queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm sum:@"age" as:nil]]];
Declaration
Swift
@objc public static func sum(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm
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
. Ifnil
, the default keysum(
is used) Return Value
a
CSSelectTerm
to aCSSelect
clause for querying the sum value for an attribute -
Provides a
CSSelectTerm
to aCSSelect
clause for querying theNSManagedObjectID
.NSManagedObjectID *objectID = [CSCoreStore queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect objectIDForTerm:[CSSelectTerm objectIDAs:nil]] fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]];
Declaration
Swift
@objc public static func objectIDAs(_ alias: KeyPathString? = nil) -> CSSelectTerm
Parameters
alias
the dictionary key to use to access the result. Ignored when the query return value is not an
NSDictionary
. Ifnil
, the default keyobjecID
is usedReturn Value
a
SelectTerm
to aSelect
clause for querying the sum value for an attribute