#define CBLAPI
Definition: CBL_Compat.h:98
#define _cbl_nullable
Definition: CBL_Compat.h:86
#define CBL_CAPI_BEGIN
Definition: CBL_Compat.h:99
#define CBL_CAPI_END
Definition: CBL_Compat.h:100
#define CBL_PUBLIC
Definition: CBL_Compat.h:117
#define CBL_ENUM(_type, _name)
Definition: CBL_Compat.h:56
#define _cbl_warn_unused
Definition: CBL_Compat.h:41
struct CBLDatabase CBLDatabase
A connection to an open database.
Definition: CBLBase.h:182
_cbl_warn_unused FLSliceResult CBLDocument_CreateJSON(const CBLDocument *)
Returns a document's properties as JSON.
bool CBLDatabase_DeleteDocumentWithConcurrencyControl(CBLDatabase *db, const CBLDocument *document, CBLConcurrencyControl concurrency, CBLError *_cbl_nullable outError)
Deletes a document from the database.
_cbl_warn_unused CBLDocument * CBLDocument_MutableCopy(const CBLDocument *original)
Creates a new mutable CBLDocument instance that refers to the same document as the original.
_cbl_warn_unused const CBLDocument *_cbl_nullable CBLDatabase_GetDocument(const CBLDatabase *database, FLString docID, CBLError *_cbl_nullable outError)
Reads a document from the database, creating a new (immutable) CBLDocument object.
_cbl_warn_unused CBLDocument * CBLDocument_Create(void)
Creates a new, empty document in memory, with a randomly-generated unique ID.
CBLConcurrencyControl
Conflict-handling options when saving or deleting a document.
Definition: CBLDocument.h:36
CBLTimestamp CBLDatabase_GetDocumentExpiration(CBLDatabase *db, FLSlice docID, CBLError *_cbl_nullable outError)
Returns the time, if any, at which a given document will expire and be purged.
FLString CBLDocument_ID(const CBLDocument *)
Returns a document's ID.
bool CBLDocument_SetJSON(CBLDocument *, FLSlice json, CBLError *_cbl_nullable outError)
Sets a mutable document's properties from a JSON string.
CBL_PUBLIC const FLSlice kCBLTypeProperty
"@type"
bool(* CBLConflictHandler)(void *_cbl_nullable context, CBLDocument *_cbl_nullable documentBeingSaved, const CBLDocument *_cbl_nullable conflictingDocument)
Custom conflict handler for use when saving or deleting a document.
Definition: CBLDocument.h:57
bool CBLDatabase_PurgeDocumentByID(CBLDatabase *database, FLString docID, CBLError *_cbl_nullable outError)
Purges a document, given only its ID.
struct CBLDocument CBLDocument
An in-memory copy of a document.
Definition: CBLBase.h:191
bool CBLDatabase_SaveDocumentWithConflictHandler(CBLDatabase *db, CBLDocument *doc, CBLConflictHandler conflictHandler, void *_cbl_nullable context, CBLError *_cbl_nullable outError)
Saves a (mutable) document to the database, allowing for custom conflict handling in the event that t...
void(* CBLDocumentChangeListener)(void *context, const CBLDatabase *db, FLString docID)
A document change listener callback, invoked after a specific document is changed on disk.
Definition: CBLDocument.h:324
uint64_t CBLDocument_Sequence(const CBLDocument *)
Returns a document's current sequence in the local database.
FLString CBLDocument_RevisionID(const CBLDocument *)
Returns a document's revision ID, which is a short opaque string that's guaranteed to be unique to ev...
FLMutableDict CBLDocument_MutableProperties(CBLDocument *)
Returns a mutable document's properties as a mutable dictionary.
_cbl_warn_unused CBLDocument *_cbl_nullable CBLDatabase_GetMutableDocument(CBLDatabase *database, FLString docID, CBLError *_cbl_nullable outError)
Reads a document from the database, in mutable form that can be updated and saved.
bool CBLDatabase_SetDocumentExpiration(CBLDatabase *db, FLSlice docID, CBLTimestamp expiration, CBLError *_cbl_nullable outError)
Sets or clears the expiration time of a document.
_cbl_warn_unused CBLListenerToken * CBLDatabase_AddDocumentChangeListener(const CBLDatabase *db, FLString docID, CBLDocumentChangeListener listener, void *_cbl_nullable context)
Registers a document change listener callback.
bool CBLDatabase_DeleteDocument(CBLDatabase *db, const CBLDocument *document, CBLError *_cbl_nullable outError)
Deletes a document from the database.
FLDict CBLDocument_Properties(const CBLDocument *)
Returns a document's properties as a dictionary.
bool CBLDatabase_SaveDocumentWithConcurrencyControl(CBLDatabase *db, CBLDocument *doc, CBLConcurrencyControl concurrency, CBLError *_cbl_nullable outError)
Saves a (mutable) document to the database.
_cbl_warn_unused CBLDocument * CBLDocument_CreateWithID(FLString docID)
Creates a new, empty document in memory, with the given ID.
void CBLDocument_SetProperties(CBLDocument *, FLMutableDict properties)
Sets a mutable document's properties.
bool CBLDatabase_SaveDocument(CBLDatabase *db, CBLDocument *doc, CBLError *_cbl_nullable outError)
Saves a (mutable) document to the database.
bool CBLDatabase_PurgeDocument(CBLDatabase *db, const CBLDocument *document, CBLError *_cbl_nullable outError)
Purges a document.
@ kCBLConcurrencyControlLastWriteWins
The current save/delete will overwrite a conflicting revision if there is a conflict.
Definition: CBLDocument.h:38
@ kCBLConcurrencyControlFailOnConflict
The current save/delete will fail if there is a conflict.
Definition: CBLDocument.h:40
struct CBLListenerToken CBLListenerToken
An opaque 'cookie' representing a registered listener callback.
Definition: CBLBase.h:259
int64_t CBLTimestamp
A date/time representation used for document expiration (and in date/time queries....
Definition: CBLBase.h:123
#define CBL_REFCOUNTED(TYPE, NAME)
Definition: CBLBase.h:170
struct _FLDict * FLMutableDict
A reference to a mutable dictionary.
Definition: Fleece.h:54
const struct _FLDict * FLDict
A reference to a dictionary (map) value.
Definition: Fleece.h:51
A struct holding information about an error.
Definition: CBLBase.h:104
A simple reference to a block of memory.
Definition: FLSlice.h:46
A heap-allocated block of memory returned from an API call.
Definition: FLSlice.h:64