![]() |
Couchbase Lite
Objective-C API for iOS and Mac OS
|
A CBLQuery subclass that automatically refreshes the result rows every time the database changes.
All you need to do is use KVO to observe changes to the .rows property.
Instance Methods | |
| (void) | - start |
| Starts observing database changes. More... | |
| (void) | - stop |
| Stops observing database changes. More... | |
| (BOOL) | - waitForRows |
| Blocks until the intial asynchronous query finishes. More... | |
| (void) | - queryOptionsChanged |
| Call this method to notify that the query parameters have been changed, the CBLLiveQuery object should re-run the query. More... | |
Instance Methods inherited from CBLQuery | |
| () | - CBLArrayOf |
| An optional array of NSSortDescriptor objects; overrides the default by-key ordering. More... | |
| (nullable CBLQueryEnumerator *) | - run: |
| Sends the query to the server and returns an enumerator over the result rows (Synchronous). More... | |
| (void) | - runAsync: |
| Starts an asynchronous query. More... | |
| (CBLLiveQuery *) | - asLiveQuery |
| Returns a live query with the same parameters. More... | |
| (instancetype) | - NS_UNAVAILABLE |
Properties | |
| NSTimeInterval | updateInterval |
| The shortest interval at which the query will update, regardless of how often the database changes. More... | |
| CBLQueryEnumerator * | rows |
| The current query results; this updates as the database changes, and can be observed using KVO. More... | |
| NSError * | lastError |
| If non-nil, the error of the last execution of the query. More... | |
Properties inherited from CBLQuery | |
| CBLView * | view |
| The view being queried; nil if this is an all-documents query. More... | |
| CBLDatabase * | database |
| The database being queried. More... | |
| NSUInteger | limit |
| The maximum number of rows to return. More... | |
| NSUInteger | skip |
| The number of initial rows to skip. More... | |
| BOOL | descending |
| Should the rows be returned in descending key order? Default value is NO. More... | |
| id | startKey |
| If non-nil, the key value to start at. More... | |
| id | endKey |
| If non-nil, the key value to end after. More... | |
| NSString * | startKeyDocID |
| If non-nil, the document ID to start at. More... | |
| NSString * | endKeyDocID |
| If non-nil, the document ID to end at. More... | |
| BOOL | inclusiveStart |
| If YES (the default) the startKey (or startKeyDocID) comparison uses ">=". More... | |
| BOOL | inclusiveEnd |
| If YES (the default) the endKey (or endKeyDocID) comparison uses "<=". More... | |
| NSUInteger | prefixMatchLevel |
| If nonzero, enables prefix matching of string or array keys. More... | |
| NSPredicate * | postFilter |
| An optional predicate that filters the resulting query rows. More... | |
| CBLIndexUpdateMode | indexUpdateMode |
| Determines whether or when the view index is updated. More... | |
| NSArray * | keys |
| If non-nil, the query will fetch only the rows with the given keys. More... | |
| BOOL | mapOnly |
| If set to YES, disables use of the reduce function. More... | |
| NSUInteger | groupLevel |
| If non-zero, enables grouping of results, in views that have reduce functions. More... | |
| BOOL | prefetch |
| If set to YES, the results will include the entire document contents of the associated rows. More... | |
| CBLAllDocsMode | allDocsMode |
| Changes the behavior of a query created by -createAllDocumentsQuery. More... | |
| NSString * | fullTextQuery |
| Query string for a full-text search; works only if the view's map function has triggered full- text indexing by emitting strings wrapped by CBLTextKey(). More... | |
| BOOL | fullTextSnippets |
| If set to YES, the query will collect snippets of the text surrounding each match, available via the CBLFullTextQueryRow's -snippetWithWordStart:wordEnd: method. More... | |
| BOOL | fullTextRanking |
| If YES (the default) the full-text query result rows will be sorted by (approximate) relevance. More... | |
| CBLGeoRect | boundingBox |
| The geometric bounding box to search. More... | |
| - (void) start |
Starts observing database changes.
The .rows property will now update automatically. (You usually don't need to call this yourself, since accessing or observing the .rows property will call -start for you.)
| - (void) stop |
Stops observing database changes.
Calling -start or .rows will restart it.
| - (BOOL) waitForRows |
Blocks until the intial asynchronous query finishes.
After this call either .rows or .lastError will be non-nil.
| - (void) queryOptionsChanged |
Call this method to notify that the query parameters have been changed, the CBLLiveQuery object should re-run the query.
|
readwritenonatomicassign |
The shortest interval at which the query will update, regardless of how often the database changes.
Defaults to 0.2 sec. Increase this if the query is expensive and the database updates frequently, to limit CPU consumption.
|
readatomicstrong |
The current query results; this updates as the database changes, and can be observed using KVO.
Its value will be nil until the initial asynchronous query finishes.
|
readatomicassign |
If non-nil, the error of the last execution of the query.
If nil, the last execution of the query was successful.