Couchbase Lite
Objective-C API for iOS and Mac OS
Classes | Macros | Typedefs | Functions
CBLView.h File Reference
#import <Foundation/Foundation.h>

Go to the source code of this file.

Classes

protocol  <CBLViewCompiler>
 An external object that knows how to map source code of some sort into executable functions. More...
 
class  CBLView
 A "view" in a CouchbaseLite database – essentially a persistent index managed by map/reduce. More...
 

Macros

#define MAPBLOCK(BLOCK)   ^(NSDictionary* doc, void (^emit)(id key, id value)){BLOCK}
 
#define REDUCEBLOCK(BLOCK)   ^id(NSArray* keys, NSArray* values, BOOL rereduce){BLOCK}
 

Typedefs

typedef void(^ CBLMapEmitBlock )(id key, id value)
 
typedef void(^ CBLMapBlock )(NSDictionary *doc, CBLMapEmitBlock emit)
 A "map" function called when a document is to be added to a view. More...
 
typedef id(^ CBLReduceBlock )(NSArray *keys, NSArray *values, BOOL rereduce)
 A "reduce" function called to summarize the results of a view. More...
 

Functions

id CBLTextKey (NSString *text)
 Returns a special value that, when emitted as a key, causes the given text to be indexed with the full-text indexer. More...
 

Macro Definition Documentation

#define MAPBLOCK (   BLOCK)    ^(NSDictionary* doc, void (^emit)(id key, id value)){BLOCK}
#define REDUCEBLOCK (   BLOCK)    ^id(NSArray* keys, NSArray* values, BOOL rereduce){BLOCK}

Typedef Documentation

typedef void(^ CBLMapEmitBlock)(id key, id value)
typedef void(^ CBLMapBlock)(NSDictionary *doc, CBLMapEmitBlock emit)

A "map" function called when a document is to be added to a view.

Parameters
docThe contents of the document being analyzed.
emitA block to be called to add a key/value pair to the view. Your block can call it zero, one or multiple times.
typedef id(^ CBLReduceBlock)(NSArray *keys, NSArray *values, BOOL rereduce)

A "reduce" function called to summarize the results of a view.

Parameters
keysAn array of keys to be reduced (or nil if this is a rereduce).
valuesA parallel array of values to be reduced, corresponding 1::1 with the keys.
rereduceYES if the input values are the results of previous reductions.
Returns
The reduced value; almost always a scalar or small fixed-size object.

Function Documentation

id CBLTextKey ( NSString *  text)

Returns a special value that, when emitted as a key, causes the given text to be indexed with the full-text indexer.

Used inside a map block, like so: emit(CBLTextKey(longText), value);