Couchbase Lite
Objective-C API for iOS and Mac OS
CBLQuery.h
Go to the documentation of this file.
1 //
2 // CBLQuery.h
3 // CouchbaseLite
4 //
5 // Created by Jens Alfke on 6/18/12.
6 // Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 
11 @class CBLDatabase, CBLDocument;
13 
14 
15 typedef enum {
21 
22 
24 typedef enum {
29 
30 
32 @interface CBLQuery : NSObject
33 
35 @property (readonly) CBLDatabase* database;
36 
38 @property NSUInteger limit;
39 
42 @property NSUInteger skip;
43 
45 @property BOOL descending;
46 
48 @property (copy) id startKey;
49 
51 @property (copy) id endKey;
52 
55 @property (copy) NSString* startKeyDocID;
56 
59 @property (copy) NSString* endKeyDocID;
60 
67 
69 @property (copy) NSArray* keys;
70 
73 @property BOOL mapOnly;
74 
76 @property NSUInteger groupLevel;
77 
82 @property BOOL prefetch;
83 
93 
96 - (CBLQueryEnumerator*) run: (NSError**)outError;
97 
103 - (void) runAsync: (void (^)(CBLQueryEnumerator*, NSError*))onComplete __attribute__((nonnull));
104 
107 
108 
109 
110 #ifdef CBL_DEPRECATED
111 @property BOOL includeDeleted __attribute__((deprecated("use allDocsMode instead")));
112 @property CBLIndexUpdateMode stale __attribute__((deprecated("renamed indexUpdateMode")));
113 - (CBLQueryEnumerator*) rows __attribute__((deprecated("renamed run:")));
114 - (CBLQueryEnumerator*) rowsIfChanged __attribute__((deprecated("use CBLQueryEnumerator.stale")));
115 @property (readonly) NSError* error __attribute__((deprecated("use error returned by run:")));
116 #endif
117 @end
118 
119 
122 @interface CBLLiveQuery : CBLQuery
123 
127 - (void) start;
128 
130 - (void) stop;
131 
134 @property (readonly, retain) CBLQueryEnumerator* rows;
135 
138 - (BOOL) waitForRows;
139 
142 @property (readonly) NSError* lastError;
143 
144 #ifdef CBL_DEPRECATED
145 @property (readonly) NSError* error __attribute__((deprecated("renamed lastError")));
146 #endif
147 
148 @end
149 
150 
153 @interface CBLQueryEnumerator : NSEnumerator <NSCopying>
154 
156 @property (readonly) NSUInteger count;
157 
159 @property (readonly) UInt64 sequenceNumber;
160 
162 @property (readonly) BOOL stale;
163 
165 - (CBLQueryRow*) nextRow;
166 
168 - (CBLQueryRow*) rowAtIndex: (NSUInteger)index;
169 
171 - (void) reset;
172 
173 @end
174 
175 
178 @interface CBLQueryRow : NSObject
179 
181 @property (readonly) id key;
182 
184 @property (readonly) id value;
185 
188 @property (readonly) NSString* documentID;
189 
195 @property (readonly) NSString* sourceDocumentID;
196 
198 @property (readonly) NSString* documentRevisionID;
199 
200 @property (readonly) CBLDatabase* database;
201 
204 @property (readonly) CBLDocument* document;
205 
211 @property (readonly) NSDictionary* documentProperties;
212 
216 - (id) keyAtIndex: (NSUInteger)index;
217 
219 @property (readonly) id key0, key1, key2, key3;
220 
222 @property (readonly) UInt64 sequenceNumber;
223 
229 @property (readonly) NSArray* conflictingRevisions;
230 
231 #ifdef CBL_DEPRECATED
232 @property (readonly) NSString* documentRevision __attribute__((deprecated("renamed documentRevisionID")));
233 @property (readonly) UInt64 localSequence __attribute__((deprecated("renamed sequenceNumber")));
234 #endif
235 @end
236 
237 
238 #ifdef CBL_DEPRECATED
239 typedef CBLIndexUpdateMode CBLStaleness __attribute__((deprecated("renamed CBLIndexUpdateMode")));
240 #endif