|
Couchbase Lite C
Couchbase Lite C API
|
#include "CBLBase.h"#include "CBLDocument.h"#include "CBLQueryIndexTypes.h"#include "CBLQueryTypes.h"Go to the source code of this file.
Data Structures | |
| struct | CBLCollectionChange |
| struct | CBLDocumentChange |
Functions | |
| CBLINLINE const CBLCollection * | CBLCollection_Retain (const CBLCollection *_cbl_nullable t) |
| CBLINLINE void | CBLCollection_Release (const CBLCollection *_cbl_nullable t) |
Collection Accessors | |
Getting information about a collection. | |
| CBLScope * | CBLCollection_Scope (const CBLCollection *collection) |
| Returns the collection's scope. | |
| FLString | CBLCollection_Name (const CBLCollection *collection) |
| Returns the collection's name. | |
| FLString | CBLCollection_FullName (const CBLCollection *collection) |
| Returns the collection's fully qualified name in the '<scope-name>. | |
| CBLDatabase * | CBLCollection_Database (const CBLCollection *collection) |
| Returns the collection's database. | |
| uint64_t | CBLCollection_Count (const CBLCollection *collection) |
| Returns the number of documents in the collection. | |
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. | |
| bool | CBLCollection_SaveDocument (CBLCollection *collection, CBLDocument *doc, CBLError *_cbl_nullable outError) |
| Saves a (mutable) document to the collection. | |
| bool | CBLCollection_SaveDocumentWithConcurrencyControl (CBLCollection *collection, CBLDocument *doc, CBLConcurrencyControl concurrency, CBLError *_cbl_nullable outError) |
| Saves a (mutable) document to the collection. | |
| 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. | |
| bool | CBLCollection_DeleteDocument (CBLCollection *collection, const CBLDocument *document, CBLError *_cbl_nullable outError) |
| Deletes a document from the collection. | |
| bool | CBLCollection_DeleteDocumentWithConcurrencyControl (CBLCollection *collection, const CBLDocument *document, CBLConcurrencyControl concurrency, CBLError *_cbl_nullable outError) |
| Deletes a document from the collection. | |
| bool | CBLCollection_PurgeDocument (CBLCollection *collection, const CBLDocument *document, CBLError *_cbl_nullable outError) |
| Purges a document. | |
| bool | CBLCollection_PurgeDocumentByID (CBLCollection *collection, FLString docID, CBLError *_cbl_nullable outError) |
| Purges a document, given only its ID. | |
| 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. | |
| bool | CBLCollection_SetDocumentExpiration (CBLCollection *collection, FLSlice docID, CBLTimestamp expiration, CBLError *_cbl_nullable outError) |
| Sets or clears the expiration time of a document. | |
Mutable documents | |
The type CBLDocument* without a const qualifier refers to a mutable document instance. 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. | |
Query Indexes | |
| bool | CBLCollection_CreateValueIndex (CBLCollection *collection, FLString name, CBLValueIndexConfiguration config, CBLError *_cbl_nullable outError) |
| Creates a value index in the collection. | |
| bool | CBLCollection_CreateFullTextIndex (CBLCollection *collection, FLString name, CBLFullTextIndexConfiguration config, CBLError *_cbl_nullable outError) |
| Creates a full-text index in the collection. | |
| bool | CBLCollection_CreateArrayIndex (CBLCollection *collection, FLString name, CBLArrayIndexConfiguration config, CBLError *_cbl_nullable outError) |
| Creates an array index for use with UNNEST queries in the collection. | |
| bool | CBLCollection_CreateVectorIndex (CBLCollection *collection, FLString name, CBLVectorIndexConfiguration config, CBLError *_cbl_nullable outError) |
| ENTERPRISE EDITION ONLY. | |
| bool | CBLCollection_DeleteIndex (CBLCollection *collection, FLString name, CBLError *_cbl_nullable outError) |
| Deletes an index in the collection by name. | |
| _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. | |
| _cbl_warn_unused CBLQueryIndex *_cbl_nullable | CBLCollection_GetIndex (CBLCollection *collection, FLString name, CBLError *_cbl_nullable outError) |
| Returns an index object representing an existing index in the collection. | |
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. | |
| _cbl_warn_unused CBLListenerToken * | CBLCollection_AddChangeListener (const CBLCollection *collection, CBLCollectionChangeListener listener, void *_cbl_nullable context) |
| Registers a collection change listener callback. | |
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. | |
| _cbl_warn_unused CBLListenerToken * | CBLCollection_AddDocumentChangeListener (const CBLCollection *collection, FLString docID, CBLCollectionDocumentChangeListener listener, void *_cbl_nullable context) |
| Registers a document change listener callback. | |
Collection Management | |
| CBL_PUBLIC const FLString | kCBLDefaultCollectionName |
| The default collection's name. | |
| FLMutableArray _cbl_nullable | CBLDatabase_ScopeNames (const CBLDatabase *db, CBLError *_cbl_nullable outError) |
| Returns the names of all existing scopes in the database. | |
| FLMutableArray _cbl_nullable | CBLDatabase_CollectionNames (const CBLDatabase *db, FLString scopeName, CBLError *_cbl_nullable outError) |
| Returns the names of all collections in the scope. | |
| CBLScope *_cbl_nullable | CBLDatabase_Scope (const CBLDatabase *db, FLString scopeName, CBLError *_cbl_nullable outError) |
| Returns an existing scope with the given name. | |
| CBLCollection *_cbl_nullable | CBLDatabase_Collection (const CBLDatabase *db, FLString collectionName, FLString scopeName, CBLError *_cbl_nullable outError) |
| Returns the existing collection with the given name and scope. | |
| CBLCollection *_cbl_nullable | CBLDatabase_CreateCollection (CBLDatabase *db, FLString collectionName, FLString scopeName, CBLError *_cbl_nullable outError) |
| Create a new collection. | |
| bool | CBLDatabase_DeleteCollection (CBLDatabase *db, FLString collectionName, FLString scopeName, CBLError *_cbl_nullable outError) |
| Delete an existing collection. | |
| CBLScope * | CBLDatabase_DefaultScope (const CBLDatabase *db, CBLError *_cbl_nullable outError) |
| Returns the default scope. | |
| CBLCollection *_cbl_nullable | CBLDatabase_DefaultCollection (const CBLDatabase *db, CBLError *_cbl_nullable outError) |
| Returns the default collection. | |