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 MFDataSchema
s, MFData
s, MFUser
s, MFBeacon
s, MFNotification
s, MFStoryline
s or MFStorylineDetail
s.
+ querySchema
Creates a new MFQuery
instance for querying MDataSchema
objects.
+ (nonnull instancetype)querySchema
Return Value
A new MFQuery
instance.
Declared In
MFQuery.h
+ queryUser
Creates a new MFQuery
instance for querying MFUser
objects.
+ (nonnull instancetype)queryUser
Return 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)limit
Parameters
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)skip
Parameters
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 *)key
Parameters
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 *)key
Parameters
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)object
Parameters
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)object
Parameters
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)object
Parameters
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)object
Parameters
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)object
Parameters
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)object
Parameters
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 *)substring
Parameters
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 *)prefix
Parameters
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 *)suffix
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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 *)key
Parameters
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)block
Parameters
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)block
Parameters
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)cancel
Declared In
MFQuery.h