Couchbase Lite
Objective-C API for iOS and Mac OS
Instance Methods | Properties | List of all members
CBLLiveQuery Class Reference

A CBLQuery subclass that automatically refreshes the result rows every time the database changes. More...

#import <CBLQuery.h>

Inheritance diagram for CBLLiveQuery:
CBLQuery

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...
 
- Instance Methods inherited from CBLQuery
(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...
 

Properties

CBLQueryEnumeratorrows
 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
CBLDatabasedatabase
 The database that contains this view. 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...
 
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 -queryAllDocuments. 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...
 

Detailed Description

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.

Method Documentation

- (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.

Property Documentation

- (CBLQueryEnumerator*) rows
readatomicretain

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.

- (NSError*) lastError
readatomicassign

If non-nil, the error of the last execution of the query.

If nil, the last execution of the query was successful.


The documentation for this class was generated from the following file: