Couchbase Lite C
Couchbase Lite C API
|
Go to the source code of this file.
Data Structures | |
struct | CBLCollectionChange |
struct | CBLDocumentChange |
Functions | |
static const CBLCollection * | CBLCollection_Retain (const CBLCollection *t) |
static void | CBLCollection_Release (const CBLCollection *t) |
Collection Accessors | |
Getting information about a collection. | |
CBLScope * | CBLCollection_Scope (const CBLCollection *collection) |
Returns the scope of the collection. More... | |
FLString | CBLCollection_Name (const CBLCollection *collection) |
Returns the collection name. More... | |
uint64_t | CBLCollection_Count (const CBLCollection *collection) |
Returns the number of documents in the collection. More... | |
Document lifecycle | |
_cbl_warn_unused const CBLDocument *_cbl_nullable | CBLCollection_GetDocument (const CBLCollection *collection, FLString docID, CBLError *_cbl_nullable outError) |
Reads a document from the collection, creating a new (immutable) CBLDocument object. More... | |
bool | CBLCollection_SaveDocument (CBLCollection *collection, CBLDocument *doc, CBLError *_cbl_nullable outError) |
Saves a (mutable) document to the collection. More... | |
bool | CBLCollection_SaveDocumentWithConcurrencyControl (CBLCollection *collection, CBLDocument *doc, CBLConcurrencyControl concurrency, CBLError *_cbl_nullable outError) |
Saves a (mutable) document to the collection. More... | |
bool | CBLCollection_SaveDocumentWithConflictHandler (CBLCollection *collection, CBLDocument *doc, CBLConflictHandler conflictHandler, void *_cbl_nullable context, CBLError *_cbl_nullable outError) |
Saves a (mutable) document to the collection, allowing for custom conflict handling in the event that the document has been updated since doc was loaded. More... | |
bool | CBLCollection_DeleteDocument (CBLCollection *collection, const CBLDocument *document, CBLError *_cbl_nullable outError) |
Deletes a document from the collection. More... | |
bool | CBLCollection_DeleteDocumentWithConcurrencyControl (CBLCollection *collection, const CBLDocument *document, CBLConcurrencyControl concurrency, CBLError *_cbl_nullable outError) |
Deletes a document from the collection. More... | |
bool | CBLCollection_PurgeDocument (CBLCollection *collection, const CBLDocument *document, CBLError *_cbl_nullable outError) |
Purges a document. More... | |
bool | CBLCollection_PurgeDocumentByID (CBLCollection *collection, FLString docID, CBLError *_cbl_nullable outError) |
Purges a document, given only its ID. More... | |
CBLTimestamp | CBLCollection_GetDocumentExpiration (CBLCollection *collection, FLSlice docID, CBLError *_cbl_nullable outError) |
Returns the time, if any, at which a given document will expire and be purged. More... | |
bool | CBLCollection_SetDocumentExpiration (CBLCollection *collection, FLSlice docID, CBLTimestamp expiration, CBLError *_cbl_nullable outError) |
Sets or clears the expiration time of a document. More... | |
Mutable documents | |
The type A mutable document exposes its properties as a mutable dictionary, so you can change them in place and then call CBLCollection_SaveDocument to persist the changes. | |
_cbl_warn_unused CBLDocument *_cbl_nullable | CBLCollection_GetMutableDocument (CBLCollection *collection, FLString docID, CBLError *_cbl_nullable outError) |
Reads a document from the collection, in mutable form that can be updated and saved. More... | |
Query Indexes | |
bool | CBLCollection_CreateValueIndex (CBLCollection *collection, FLString name, CBLValueIndexConfiguration config, CBLError *_cbl_nullable outError) |
Creates a value index in the collection. More... | |
bool | CBLCollection_CreateFullTextIndex (CBLCollection *collection, FLString name, CBLFullTextIndexConfiguration config, CBLError *_cbl_nullable outError) |
Creates a full-text index in the collection. More... | |
bool | CBLCollection_DeleteIndex (CBLCollection *collection, FLString name, CBLError *_cbl_nullable outError) |
Deletes an index in the collection by name. More... | |
_cbl_warn_unused FLMutableArray _cbl_nullable | CBLCollection_GetIndexNames (CBLCollection *collection, CBLError *_cbl_nullable outError) |
Returns the names of the indexes in the collection, as a Fleece array of strings. More... | |
Change Listeners | |
A collection change listener lets you detect changes made to all documents in a collection. (If you want to observe specific documents, use a CBLCollectionDocumentChangeListener instead.)
| |
typedef void(* | CBLCollectionChangeListener) (void *_cbl_nullable context, const CBLCollectionChange *change) |
A collection change listener callback, invoked after one or more documents are changed on disk. More... | |
_cbl_warn_unused CBLListenerToken * | CBLCollection_AddChangeListener (const CBLCollection *collection, CBLCollectionChangeListener listener, void *_cbl_nullable context) |
Registers a collection change listener callback. More... | |
Document listeners | |
A document change listener lets you detect changes made to a specific document after they are persisted to the collection.
| |
typedef void(* | CBLCollectionDocumentChangeListener) (void *context, const CBLDocumentChange *change) |
A document change listener callback, invoked after a specific document is changed on disk. More... | |
_cbl_warn_unused CBLListenerToken * | CBLCollection_AddDocumentChangeListener (const CBLCollection *collection, FLString docID, CBLCollectionDocumentChangeListener listener, void *_cbl_nullable context) |
Registers a document change listener callback. More... | |