LiteCore
Couchbase Lite cross-platform core implementation
|
Go to the source code of this file.
Functions | |
Lifecycle | |
CBL_CORE_API C4Collection * | c4db_getDefaultCollection (C4Database *db, C4Error *outError) |
Returns the default collection, whose name is "`_default`" (kC4DefaultCollectionName ). | |
CBL_CORE_API bool | c4db_hasCollection (C4Database *db, C4CollectionSpec spec) |
Returns true if the collection exists. | |
CBL_CORE_API bool | c4db_hasScope (C4Database *db, C4String name) |
Returns true if the named scope exists. | |
CBL_CORE_API C4Collection * | c4db_getCollection (C4Database *db, C4CollectionSpec spec, C4Error *outError) |
Returns the existing collection with the given name & scope, or NULL if it doesn't exist. | |
NODISCARD CBL_CORE_API C4Collection * | c4db_createCollection (C4Database *db, C4CollectionSpec spec, C4Error *outError) |
Creates and returns an empty collection with the given name & scope. | |
NODISCARD CBL_CORE_API bool | c4db_deleteCollection (C4Database *db, C4CollectionSpec spec, C4Error *outError) |
Deletes the collection with the given name & scope. | |
NODISCARD CBL_CORE_API FLMutableArray | c4db_collectionNames (C4Database *db, C4String inScope, C4Error *outError) |
Returns the names of all existing collections in the given scope, in the order in which they were created. | |
NODISCARD CBL_CORE_API FLMutableArray | c4db_scopeNames (C4Database *db, C4Error *outError) |
Returns the names of all existing scopes, in the order in which they were created. | |
Accessors | |
CBL_CORE_API bool | c4coll_isValid (C4Collection *) |
Returns false if this collection has been deleted, or its database closed. | |
CBL_CORE_API C4CollectionSpec | c4coll_getSpec (C4Collection *) |
Returns the name and scope of the collection. | |
CBL_CORE_API C4Database * | c4coll_getDatabase (C4Collection *) |
Returns the database containing the collection, or NULL if the collection is invalid. | |
CBL_CORE_API uint64_t | c4coll_getDocumentCount (C4Collection *) |
Returns the number of (undeleted) documents in the collection. | |
CBL_CORE_API C4SequenceNumber | c4coll_getLastSequence (C4Collection *) |
Returns the latest sequence number allocated to a revision. | |
Documents | |
NODISCARD CBL_CORE_API C4Document * | c4coll_getDoc (C4Collection *collection, C4String docID, bool mustExist, C4DocContentLevel content, C4Error *outError) |
Gets a document from the collection given its ID. | |
NODISCARD CBL_CORE_API C4Document * | c4coll_getDocBySequence (C4Collection *collection, C4SequenceNumber, C4Error *outError) |
Gets a document from the collection given its sequence number. | |
NODISCARD CBL_CORE_API C4Document * | c4coll_putDoc (C4Collection *collection, const C4DocPutRequest *request, size_t *outCommonAncestorIndex, C4Error *outError) |
A high-level Put operation, to insert a new or downloaded revision. | |
NODISCARD CBL_CORE_API C4Document * | c4coll_createDoc (C4Collection *collection, C4String docID, C4Slice body, C4RevisionFlags revisionFlags, C4Error *error) |
Convenience function to create a new document. | |
NODISCARD CBL_CORE_API bool | c4coll_moveDoc (C4Collection *collection, C4String docID, C4Collection *toCollection, C4String newDocID, C4Error *error) |
Moves a document to another collection, possibly with a different docID. | |
Purging and Expiration | |
NODISCARD CBL_CORE_API bool | c4coll_purgeDoc (C4Collection *collection, C4String docID, C4Error *outError) |
Removes all trace of a document and its revisions from the collection. | |
NODISCARD CBL_CORE_API bool | c4coll_setDocExpiration (C4Collection *collection, C4String docID, C4Timestamp timestamp, C4Error *outError) |
Sets an expiration date on a document. | |
CBL_CORE_API C4Timestamp | c4coll_getDocExpiration (C4Collection *collection, C4String docID, C4Error *outError) |
Returns the expiration time of a document, if one has been set, else 0. | |
CBL_CORE_API C4Timestamp | c4coll_nextDocExpiration (C4Collection *) |
Returns the time at which the next document expiration in this collection should take place, or 0 if there are no documents with expiration times. | |
NODISCARD CBL_CORE_API int64_t | c4coll_purgeExpiredDocs (C4Collection *, C4Error *) |
Purges all documents that have expired. | |