SFQuerySpec Class Reference

Inherits from NSObject
Declared in SFQuerySpec.h

Overview

Object containing the query specification for queries against a soup.

  queryType

The type of query to run (exact, range, like).

@property (nonatomic, assign) SFSoupQueryType queryType

Declared In

SFQuerySpec.h

  smartSql

smartSql passed in for smart queries, computed for all others.

@property (nonatomic, strong) NSString *smartSql

Declared In

SFQuerySpec.h

  countSmartSql

countSmartSql: query to compute count of results for smartSql

@property (nonatomic, strong) NSString *countSmartSql

Declared In

SFQuerySpec.h

  idsSmartSql

idsSmartSql: query returning only ids

@property (nonatomic, strong) NSString *idsSmartSql

Declared In

SFQuerySpec.h

  pageSize

The number of entries per page to return.

@property (nonatomic, assign) NSUInteger pageSize

Declared In

SFQuerySpec.h

  soupName

soupName is used for range, exact, and like queries.

@property (nonatomic, strong) NSString *soupName

Declared In

SFQuerySpec.h

  selectPaths

The paths to return in an array. nil means return the entire soup element.

@property (nonatomic, strong, nullable) NSArray *selectPaths

Declared In

SFQuerySpec.h

  path

The indexPath to use for the query. Compound paths must be dot-delimited ie parent.child.grandchild.field .

@property (nonatomic, strong) NSString *path

Declared In

SFQuerySpec.h

  beginKey

beginKey is used for range queries.

@property (nonatomic, strong) NSString *beginKey

Declared In

SFQuerySpec.h

  endKey

endKey is used for range queries.

@property (nonatomic, strong) NSString *endKey

Declared In

SFQuerySpec.h

  likeKey

likeKey is used for like queries.

@property (nonatomic, strong) NSString *likeKey

Declared In

SFQuerySpec.h

  matchKey

matchKey is used for exact and match queries.

@property (nonatomic, strong) NSString *matchKey

Declared In

SFQuerySpec.h

  orderPath

The indexPath to use for sorting. Compound paths must be dot-delimited ie parent.child.grandchild.field .

@property (nonatomic, strong) NSString *orderPath

Declared In

SFQuerySpec.h

  order

A sort order for the query (ascending, descending).

@property (nonatomic, assign) SFSoupQuerySortOrder order

Declared In

SFQuerySpec.h

  sqlSortOrder

ASC or DESC

@property (strong, nonatomic, readonly) NSString *sqlSortOrder

Declared In

SFQuerySpec.h

+ newExactQuerySpec:withSelectPaths:withPath:withMatchKey:withOrderPath:withOrder:withPageSize:

Factory method to build an exact query spec Note: caller is responsible for releaseing the query spec

+ (nullable SFQuerySpec *)newExactQuerySpec:(NSString *)soupName withSelectPaths:(nullable NSArray *)selectPaths withPath:(NSString *)path withMatchKey:(NSString *)matchKey withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

Parameters

soupName

The target soup name.

selectPaths

The paths to return - if nil the entire soup element is returned.

path

The path to filter on.

matchKey

The exact value to match.

orderPath

The path to sort by.

order

The sort order.

pageSize

The page size.

Return Value

A query spec object.

Declared In

SFQuerySpec.h

+ newExactQuerySpec:withPath:withMatchKey:withOrderPath:withOrder:withPageSize:

+ (SFQuerySpec *)newExactQuerySpec:(NSString *)soupName withPath:(NSString *)path withMatchKey:(NSString *)matchKey withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

+ newLikeQuerySpec:withSelectPaths:withPath:withLikeKey:withOrderPath:withOrder:withPageSize:

Factory method to build an like query spec Note: caller is responsible for releaseing the query spec

+ (nullable SFQuerySpec *)newLikeQuerySpec:(NSString *)soupName withSelectPaths:(nullable NSArray *)selectPaths withPath:(NSString *)path withLikeKey:(NSString *)likeKey withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

Parameters

soupName

The target soup name.

selectPaths

The paths to return - if nil the entire soup element is returned.

path

The path to filter on.

likeKey

The value to match on.

orderPath

The path to sort by.

order

The sort order.

pageSize

The page size.

Return Value

A query spec object.

Declared In

SFQuerySpec.h

+ newLikeQuerySpec:withPath:withLikeKey:withOrderPath:withOrder:withPageSize:

+ (SFQuerySpec *)newLikeQuerySpec:(NSString *)soupName withPath:(NSString *)path withLikeKey:(NSString *)likeKey withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

+ newRangeQuerySpec:withSelectPaths:withPath:withBeginKey:withEndKey:withOrderPath:withOrder:withPageSize:

Factory method to build an range query spec Note: caller is responsible for releaseing the query spec

+ (nullable SFQuerySpec *)newRangeQuerySpec:(NSString *)soupName withSelectPaths:(nullable NSArray *)selectPaths withPath:(nullable NSString *)path withBeginKey:(nullable NSString *)beginKey withEndKey:(nullable NSString *)endKey withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

Parameters

soupName

The target soup name.

selectPaths

The paths to return - if nil the entire soup element is returned.

path

The path to filter on.

beginKey

The start of the range.

endKey

The end of the range.

orderPath

The path to sort by.

order

The sort order.

pageSize

The page size.

Return Value

A query spec object.

Declared In

SFQuerySpec.h

+ newRangeQuerySpec:withPath:withBeginKey:withEndKey:withOrderPath:withOrder:withPageSize:

+ (SFQuerySpec *)newRangeQuerySpec:(NSString *)soupName withPath:(NSString *)path withBeginKey:(NSString *)beginKey withEndKey:(NSString *)endKey withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

+ newAllQuerySpec:withSelectPaths:withOrderPath:withOrder:withPageSize:

Factory method to build a query spec to return all data from a soup.

+ (SFQuerySpec *)newAllQuerySpec:(NSString *)soupName withSelectPaths:(nullable NSArray *)selectPaths withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

Parameters

soupName

The target soup name.

selectPaths

The paths to return - if nil the entire soup element is returned.

orderPath

The path to sort by.

order

The sort order.

pageSize

The page size.

Declared In

SFQuerySpec.h

+ newAllQuerySpec:withOrderPath:withOrder:withPageSize:

+ (SFQuerySpec *)newAllQuerySpec:(NSString *)soupName withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

+ newMatchQuerySpec:withSelectPaths:withPath:withMatchKey:withOrderPath:withOrder:withPageSize:

Factory method to build a match query spec (full-text search) Note: caller is responsible for releaseing the query spec

+ (nullable SFQuerySpec *)newMatchQuerySpec:(NSString *)soupName withSelectPaths:(nullable NSArray *)selectPaths withPath:(NSString *)path withMatchKey:(NSString *)matchKey withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

Parameters

soupName

The target soup name.

selectPaths

The paths to return - if nil the entire soup element is returned.

path

The path to filter on - can be nil to match against any full-text indexed paths.

matchKey

The match query string.

orderPath

The path to sort by.

order

The sort order.

pageSize

The page size.

Return Value

A query spec object.

Declared In

SFQuerySpec.h

+ newMatchQuerySpec:withPath:withMatchKey:withOrderPath:withOrder:withPageSize:

+ (SFQuerySpec *)newMatchQuerySpec:(NSString *)soupName withPath:(NSString *)path withMatchKey:(NSString *)matchKey withOrderPath:(NSString *)orderPath withOrder:(SFSoupQuerySortOrder)order withPageSize:(NSUInteger)pageSize

+ newSmartQuerySpec:withPageSize:

Factory method to build a smart query spec Note: caller is responsible for releaseing the query spec

+ (nullable SFQuerySpec *)newSmartQuerySpec:(NSString *)smartSql withPageSize:(NSUInteger)pageSize

Parameters

smartSql

The smart sql query.

pageSize

The page size.

Return Value

A query spec object.

Declared In

SFQuerySpec.h

– initWithDictionary:withSoupName:

Initializes the object with the given query spec.

- (id)initWithDictionary:(NSDictionary *)querySpec withSoupName:(NSString *)targetSoupName

Parameters

querySpec

the name/value pairs defining the query spec.

targetSoupName

the soup name targeted (not nil for exact/like/range queries)

Return Value

A new instance of the object.

Declared In

SFQuerySpec.h

– asDictionary

The NSDictionary representation of the query spec.

- (NSDictionary *)asDictionary

Declared In

SFQuerySpec.h

– bindsForQuerySpec

Return bind arguments for query.

- (nullable NSArray *)bindsForQuerySpec

Return Value

bind arguments.

Declared In

SFQuerySpec.h

+ queryTypeFromString:

Enum to/from string helper methods

+ (SFSoupQueryType)queryTypeFromString:(NSString *)queryType

Declared In

SFQuerySpec.h

+ queryTypeFromEnum:

+ (NSString *)queryTypeFromEnum:(SFSoupQueryType)queryType

+ sortOrderFromString:

+ (SFSoupQuerySortOrder)sortOrderFromString:(NSString *)sortOrder

+ sortOrderFromEnum:

+ (NSString *)sortOrderFromEnum:(SFSoupQuerySortOrder)sortOrder