9 #import <Foundation/Foundation.h> 36 NSArray* __nonnull values,
40 #define MAPBLOCK(BLOCK) ^(CBLJSONDict* doc, void (^emit)(id key, id value)){BLOCK} 41 #define REDUCEBLOCK(BLOCK) ^id(NSArray* keys, NSArray* values, BOOL rereduce){BLOCK} 46 FOUNDATION_EXTERN
id CBLTextKey(NSString* text);
49 @protocol CBLViewCompiler <NSObject>
50 - (
nullable CBLMapBlock) compileMapFunction: (NSString*)mapSource language: (NSString*)language;
52 language: (NSString*)language;
64 @property (readonly) NSString*
name;
83 version: (NSString*)version;
88 version: (NSString*)version;
97 @property (readonly) BOOL
stale;
116 - (void) updateIndexAsync: (
void (^)())onComplete;
128 + (NSNumber*) totalValues: (NSArray*)values;
131 + (void) setCompiler: (
nullable id<CBLViewCompiler>)compiler;
#define NS_ASSUME_NONNULL_BEGIN
Definition: CBLBase.h:20
A "view" in a CouchbaseLite database – essentially a persistent index managed by map/reduce...
Definition: CBLView.h:58
SInt64 lastSequenceIndexed
The last sequence number indexed so far.
Definition: CBLView.h:100
A CouchbaseLite database.
Definition: CBLDatabase.h:38
#define __nullable
Definition: CBLBase.h:23
CBLViewIndexType
Definition: CBLView.h:15
__nonnull id(^ CBLReduceBlock)(NSArray *__nonnull keys, NSArray *__nonnull values, BOOL rereduce)
A "reduce" function called to summarize the results of a view.
Definition: CBLView.h:35
#define nullable
Definition: CBLBase.h:22
Keys must be strings and will be indexed by the words they contain.
Definition: CBLView.h:17
Represents a query of a CouchbaseLite 'view', or of a view-like resource like _all_documents.
Definition: CBLQuery.h:34
BOOL stale
Is the view's index currently out of date?
Definition: CBLView.h:97
NSUInteger totalRows
Total number of rows in the view.
Definition: CBLView.h:104
CBLMapBlock mapBlock
The map function that controls how index rows are created from documents.
Definition: CBLView.h:67
NSString * name
The name of the view.
Definition: CBLView.h:64
FOUNDATION_EXTERN id CBLTextKey(NSString *text)
Returns a special value that, when emitted as a key, causes the given text to be indexed with the ful...
Regular map/reduce index with JSON keys.
Definition: CBLView.h:16
#define NS_ASSUME_NONNULL_END
Definition: CBLBase.h:21
nullable id< CBLViewCompiler > compiler()
The registered object, if any, that can compile map/reduce functions from source code.
void deleteIndex()
Deletes the view's persistent index.
void(^ CBLMapBlock)(CBLJSONDict *doc, CBLMapEmitBlock emit)
A "map" function called when a document is to be added to a view.
Definition: CBLView.h:28
CBLQuery * createQuery()
Creates a new query object for this view.
void(^ CBLMapEmitBlock)(id key, __nullable id value)
Definition: CBLView.h:22
void deleteView()
Deletes the view, persistently.
instancetype NS_UNAVAILABLE()
CBLReduceBlock reduceBlock
The optional reduce function, which aggregates together multiple rows.
Definition: CBLView.h:70
void updateIndex()
Updates the view's index, then returns YES if the index changed or NO if it didn't.
CBLDatabase * database
The database that owns this view.
Definition: CBLView.h:61
NSString * documentType
If this property is set, only documents whose "type" property is equal to its value will be passed to...
Definition: CBLView.h:94
Geo-query index; not supported yet.
Definition: CBLView.h:18