MFQuery Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | MFQuery.h MFQuery.m |
Overview
The MFQuery class defines a query that is used to query for MFDataSchemas, MFDatas, MFUsers, MFBeacons, MFNotifications, MFStorylines or MFStorylineDetails.
+ querySchema
Creates a new MFQuery instance for querying MDataSchema objects.
+ (nonnull instancetype)querySchemaReturn Value
A new MFQuery instance.
Declared In
MFQuery.h
+ queryUser
Creates a new MFQuery instance for querying MFUser objects.
+ (nonnull instancetype)queryUserReturn Value
A new MFQuery instance.
See Also
MFQuery.+ queryUser
Declared In
MFQuery.h
– setLimit:
Add limit on the number of objects to return. The default limit is 100, with a maximum of 1000 results being returned at a time.
- (nonnull instancetype)setLimit:(NSInteger)limitParameters
limit |
The number of limit that objects should return. |
|---|
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– setSkip:
Add the number of objects to skip before returning any.
- (nonnull instancetype)setSkip:(NSInteger)skipParameters
skip |
The number of objects to skip |
|---|
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKeyExists:
Add a constraint that requires a particular key exists.
- (nonnull instancetype)whereKeyExists:(nonnull NSString *)keyParameters
key |
The key that should exist. |
|---|
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKeyDoesNotExist:
Add a constraint that requires a key not exist.
- (nonnull instancetype)whereKeyDoesNotExist:(nonnull NSString *)keyParameters
key |
The key that should not exist. |
|---|
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKey:equalTo:
Add a constraint to the query that requires a particular key’s object to be equal to the provided object.
- (nonnull instancetype)whereKey:(nonnull NSString *)key equalTo:(nonnull id)objectParameters
key |
The key to be constrained. |
|---|---|
object |
The object that must be equalled. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKey:lessThan:
Add a constraint to the query that requires a particular key’s object to be less than the provided object.
- (nonnull instancetype)whereKey:(nonnull NSString *)key lessThan:(nonnull id)objectParameters
key |
The key to be constrained. |
|---|---|
object |
The object that provides an upper bound. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKey:lessThanOrEqualTo:
Add a constraint to the query that requires a particular key’s object to be less than or equal to the provided object.
- (nonnull instancetype)whereKey:(nonnull NSString *)key lessThanOrEqualTo:(nonnull id)objectParameters
key |
The key to be constrained. |
|---|---|
object |
The object that must be equalled. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKey:greaterThan:
Add a constraint to the query that requires a particular key’s object to be greater than the provided object.
- (nonnull instancetype)whereKey:(nonnull NSString *)key greaterThan:(nonnull id)objectParameters
key |
The key to be constrained. |
|---|---|
object |
The object that must be equalled. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKey:greaterThanOrEqualTo:
Add a constraint to the query that requires a particular key’s object to be greater than or equal to the provided object.
- (nonnull instancetype)whereKey:(nonnull NSString *)key greaterThanOrEqualTo:(nonnull id)objectParameters
key |
The key to be constrained. |
|---|---|
object |
The object that must be equalled. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKey:notEqualTo:
Add a constraint to the query that requires a particular key’s object to be not equal to the provided object.
- (nonnull instancetype)whereKey:(nonnull NSString *)key notEqualTo:(nonnull id)objectParameters
key |
The key to be constrained. |
|---|---|
object |
The object that must not be equalled. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– whereKey:containsString:
Add a constraint for finding string values that contain a provided substring.
- (nonnull instancetype)whereKey:(nonnull NSString *)key containsString:(nullable NSString *)substringParameters
key |
The key that the string to match is stored in. |
|---|---|
substring |
The substring that the value must contain. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Discussion
Warning: This will be slow for large datasets.
Declared In
MFQuery.h
– whereKey:hasPrefix:
Add a constraint for finding string values that start with a provided prefix.
- (nonnull instancetype)whereKey:(nonnull NSString *)key hasPrefix:(nullable NSString *)prefixParameters
key |
The key that the string to match is stored in. |
|---|---|
prefix |
The substring that the value must start with. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Discussion
This will use smart indexing, so it will be fast for large datasets.
Declared In
MFQuery.h
– whereKey:hasSuffix:
Add a constraint for finding string values that end with a provided suffix.
- (nonnull instancetype)whereKey:(nonnull NSString *)key hasSuffix:(nullable NSString *)suffixParameters
key |
The key that the string to match is stored in. |
|---|---|
suffix |
The substring that the value must end with. |
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Discussion
Warning: This will be slow for large datasets.
Declared In
MFQuery.h
– orderByAscending:
Sort the results in ascending order with the given key.
- (nonnull instancetype)orderByAscending:(nonnull NSString *)keyParameters
key |
The key to order by. |
|---|
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– addAscendingOrder:
Additionally sort in ascending order by the given key.
- (nonnull instancetype)addAscendingOrder:(nonnull NSString *)keyParameters
key |
The key to order by. |
|---|
Discussion
The previous keys provided will precedence over this key.
Declared In
MFQuery.h
– orderByDescending:
Sort the results in descending order with the given key.
- (nonnull instancetype)orderByDescending:(nonnull NSString *)keyParameters
key |
The key to order by. |
|---|
Return Value
The same instance of MFQuery as the receiver. This allows method chaining.
Declared In
MFQuery.h
– addDescendingOrder:
Additionally sort in descending order by the given key.
- (nonnull instancetype)addDescendingOrder:(nonnull NSString *)keyParameters
key |
The key to order by. |
|---|
Discussion
The previous keys provided will precedence over this key.
Declared In
MFQuery.h
– findAsyncWithBlock:
Finds objects asynchronously and calls the given block with the results.
- (void)findAsyncWithBlock:(nullable MFArrayResultBlock)blockParameters
block |
The block to execute. It should have the following argument signature: |
|---|
Declared In
MFQuery.h
– countAsyncWithBlock:
Counts objects asynchronously and calls the given block with the counts.
- (void)countAsyncWithBlock:(nullable MFIntegerResultBlock)blockParameters
block |
The block to execute. It should have the following argument signature: |
|---|
Declared In
MFQuery.h
– cancel
Cancels the current network request (if any). Ensures that callbacks won’t be called.
- (void)cancelDeclared In
MFQuery.h