public static long c4doc_getExpiration(C4Database *db, string docId) { using (var docId_ = new C4String(docId)) { return(NativeRaw.c4doc_getExpiration(db, docId_.AsFLSlice())); } }
public static C4BlobStore *c4blob_openStore(string dirPath, C4DatabaseFlags flags, C4EncryptionKey *encryptionKey, C4Error *outError) { using (var dirPath_ = new C4String(dirPath)) { return(NativeRaw.c4blob_openStore(dirPath_.AsFLSlice(), flags, encryptionKey, outError)); } }
public static bool c4db_purgeDoc(C4Database *database, string docID, C4Error *outError) { using (var docID_ = new C4String(docID)) { return(NativeRaw.c4db_purgeDoc(database, docID_.AsFLSlice(), outError)); } }
/// <summary> /// Opens a view, or creates it if the file doesn't already exist. /// </summary> /// <param name="db">The database the view is associated with</param> /// <param name="path">The file that the view is stored in</param> /// <param name="viewName">The name of the view</param> /// <param name="version">The version of the view's map function</param> /// <param name="flags">The flags for opening the view file</param> /// <param name="encryptionKey">The option encryption key used to encrypt the database</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>A pointer to the view on success, otherwise null</returns> public static C4View* c4view_open(C4Database *db, string path, string viewName, string version, C4DatabaseFlags flags, C4EncryptionKey *encryptionKey, C4Error *outError) { using(var path_ = new C4String(path)) using(var viewName_ = new C4String(viewName)) using(var version_ = new C4String(version)) { return c4view_open(db, path_.AsC4Slice(), viewName_.AsC4Slice(), version_.AsC4Slice(), flags, encryptionKey, outError); } }
public static bool FLEncoder_WriteKey(FLEncoder *encoder, string str) { using (var str_ = new C4String(str)) { return(NativeRaw.FLEncoder_WriteKey(encoder, (FLSlice)str_.AsFLSlice())); } }
public static C4QueryEnumerator *c4query_run(C4Query *query, C4QueryOptions *options, string encodedParameters, C4Error *outError) { using (var encodedParameters_ = new C4String(encodedParameters)) { return(NativeRaw.c4query_run(query, options, encodedParameters_.AsFLSlice(), outError)); } }
public static void c4kv_add(C4KeyValueList *kv, C4Key *key, string value) { using (var value_ = new C4String(value)) { NativeRaw.c4kv_add(kv, key, value_.AsC4Slice()); } }
/// <summary> /// Selects a specific revision of a document (or no revision, if revID is NULL.) /// </summary> /// <param name="doc">The document to operate on</param> /// <param name="revID">The revID of the revision to select</param> /// <param name="withBody">Whether or not to load the body of the revision</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>true on success, false otherwise</returns> public static bool c4doc_selectRevision(C4Document *doc, string revID, bool withBody, C4Error *outError) { using(var revID_ = new C4String(revID)) { return c4doc_selectRevision(doc, revID_.AsC4Slice(), withBody, outError); } }
/// <summary> /// Creates an enumerator ordered by docID. /// Options have the same meanings as in Couchbase Lite. /// There's no 'limit' option; just stop enumerating when you're done. /// Caller is responsible for freeing the enumerator when finished with it. /// </summary> /// <param name="db">The database to operate on</param> /// <param name="startDocID">The document ID to begin at</param> /// <param name="endDocID">The document ID to end at</param> /// <param name="options">Enumeration options (NULL for defaults)</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>A pointer to the enumeator on success, otherwise null</returns> public static C4DocEnumerator* c4db_enumerateAllDocs(C4Database *db, string startDocID, string endDocID, C4EnumeratorOptions *options, C4Error *outError) { using(var startDocID_ = new C4String(startDocID)) using(var endDocID_ = new C4String(endDocID)) { return c4db_enumerateAllDocs(db, startDocID_.AsC4Slice(), endDocID_.AsC4Slice(), options, outError); } }
/// <summary> /// Gets a document from the database. If there's no such document, the behavior depends on /// the mustExist flag.If it's true, NULL is returned. If it's false, a valid C4Document /// The current revision is selected(if the document exists.) /// </summary> /// <param name="db">The database to retrieve from</param> /// <param name="docID">The ID of the document to retrieve</param> /// <param name="mustExist">Whether or not to create the document on demand</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>A pointer to the retrieved document on success, or null on failure</returns> public static C4Document* c4doc_get(C4Database *db, string docID, bool mustExist, C4Error *outError) { using(var docID_ = new C4String(docID)) { return c4doc_get(db, docID_.AsC4Slice(), mustExist, outError); } }
public static bool c4db_purgeDoc(C4Database *db, string docId, C4Error *outError) { using (var docId_ = new C4String(docId)) { return c4db_purgeDoc(db, docId_.AsC4Slice(), outError); } }
/// <summary> /// Writes a raw document to the database, or deletes it if both meta and body are NULL. /// </summary> /// <param name="db">The database to operate on</param> /// <param name="storeName">The store to write to</param> /// <param name="key">The key to store</param> /// <param name="meta">The metadata to store</param> /// <param name="body">The body to store</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>true on success, false otherwise</returns> public static bool c4raw_put(C4Database *db, string storeName, string key, string meta, string body, C4Error *outError) { using(var storeName_ = new C4String(storeName)) using(var key_ = new C4String(key)) using(var meta_ = new C4String(meta)) using(var body_ = new C4String(body)) { return c4raw_put(db, storeName_.AsC4Slice(), key_.AsC4Slice(), meta_.AsC4Slice(), body_.AsC4Slice(), outError); } }
/// <summary> /// Reads a raw document from the database. In Couchbase Lite the store named "info" is used for /// per-database key/value pairs, and the store "_local" is used for local documents. /// </summary> /// <param name="db">The database to operate on</param> /// <param name="storeName">The name of the store to read from</param> /// <param name="docID">The ID of the document to retrieve</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>A pointer to the retrieved document on success, or null on failure</returns> public static C4RawDocument* c4raw_get(C4Database *db, string storeName, string docID, C4Error *outError) { using(var storeName_ = new C4String(storeName)) using(var docID_ = new C4String(docID)) { return c4raw_get(db, storeName_.AsC4Slice(), docID_.AsC4Slice(), outError); } }
/// <summary> /// Opens a database. /// </summary> /// <param name="path">The path to the DB file</param> /// <param name="readOnly">Whether or not the DB should be opened in read-only mode</param> /// <param name="encryptionKey">The option encryption key used to encrypt the database</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>A database instance for use in the C4 API</returns> public static C4Database *c4db_open(string path, C4DatabaseFlags flags, C4EncryptionKey *encryptionKey, C4Error *outError) { using(var path_ = new C4String(path)) { return c4db_open(path_.AsC4Slice(), flags, encryptionKey, outError); } }
public static bool c4doc_selectRevision(C4Document *doc, string revID, bool withBody, C4Error *outError) { using (var revID_ = new C4String(revID)) { return(NativeRaw.c4doc_selectRevision(doc, revID_.AsFLSlice(), withBody, outError)); } }
/// <summary> /// Adds a revision to a document, as a child of the currently selected revision /// (or as a root revision if there is no selected revision.) /// On success, the new revision will be selected. /// Must be called within a transaction. /// </summary> /// <param name="doc">The document to operate on</param> /// <param name="revID">The ID of the revision being inserted</param> /// <param name="body">The (JSON) body of the revision</param> /// <param name="deleted">True if this revision is a deletion (tombstone)</param> /// <param name="hasAttachments">True if this revision contains an _attachments dictionary</param> /// <param name="allowConflict">If false, and the parent is not a leaf, a 409 error is returned</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>The number of revisions inserted (0, 1, or -1 on error)</returns> public static int c4doc_insertRevision(C4Document *doc, string revID, string body, bool deleted, bool hasAttachments, bool allowConflict, C4Error *outError) { using(var revID_ = new C4String(revID)) using(var body_ = new C4String(body)) { return c4doc_insertRevision(doc, revID_.AsC4Slice(), body_.AsC4Slice(), deleted, hasAttachments, allowConflict, outError); } }
public static uint c4rev_getGeneration(string revID) { using (var revID_ = new C4String(revID)) { return(NativeRaw.c4rev_getGeneration(revID_.AsFLSlice())); } }
/// <summary> /// Adds a revision to a document, plus its ancestors (given in reverse chronological order.) /// On success, the new revision will be selected. /// Must be called within a transaction. /// <param name="doc">The document to operate on</param> /// <param name="body">The (JSON) body of the revision</param> /// <param name="deleted">True if this revision is a deletion (tombstone)</param> /// <param name="hasAttachments">True if this revision contains an _attachments dictionary</param> /// <param name="history">The ancestors' revision IDs, starting with the parent, in reverse order</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>The number of revisions added to the document, or -1 on error.</returns> public static int c4doc_insertRevisionWithHistory(C4Document *doc, string body, bool deleted, bool hasAttachments, string[] history, C4Error *outError) { var flattenedStringArray = new C4String[history.Length + 1]; flattenedStringArray[0] = new C4String(body); for(int i = 0; i < history.Length; i++) { flattenedStringArray[i + 1] = new C4String(history[i]); } var sliceArray = flattenedStringArray.Skip(1).Select<C4String, C4Slice>(x => x.AsC4Slice()).ToArray(); var retVal = default(int); fixed(C4Slice *a = sliceArray) { retVal = c4doc_insertRevisionWithHistory(doc, flattenedStringArray[0].AsC4Slice(), deleted, hasAttachments, a, (uint)history.Length, outError); } foreach(var s in flattenedStringArray) { s.Dispose(); } return retVal; }
public static void c4key_addMapKey(C4Key *key, string str) { using (var str_ = new C4String(str)) { NativeRaw.c4key_addMapKey(key, str_.AsC4Slice()); } }
/// <summary> /// Sets a document's docType. (By convention this is the value of the "type" property of the /// current revision's JSON; this value can be used as optimization when indexing a view.) /// The change will not be persisted until the document is saved. /// </summary> /// <param name="doc">The document to operate on</param> /// <param name="docType">The document type to set</param> /// <param name="outError">The error that occurred if the operation doesn't succeed</param> /// <returns>true on success, false otherwise</returns> public static bool c4doc_setType(C4Document *doc, string docType, C4Error *outError) { using(var docType_ = new C4String(docType)) { return c4doc_setType(doc, docType_.AsC4Slice(), outError); } }
public static C4DocumentObserver *c4docobs_create(C4Database *database, string docID, C4DocumentObserverCallback callback, void *context) { using (var docID_ = new C4String(docID)) { return(NativeRaw.c4docobs_create(database, docID_.AsFLSlice(), callback, context)); } }
public static int c4doc_purgeRevision(C4Document *doc, string revId, C4Error *outError) { using(var revId_ = new C4String(revId)) { return c4doc_purgeRevision(doc, revId_.AsC4Slice(), outError); } }
public static int FLSharedKeys_Encode(FLSharedKeys *shared, string str, bool add) { using (var str_ = new C4String(str)) { return(NativeRaw.FLSharedKeys_Encode(shared, (FLSlice)str_.AsFLSlice(), add)); } }
/// <summary> /// Adds a map key, before the next value. When adding to a map, every value must be /// preceded by a key. /// </summary> /// <param name="key">The key to operate on</param> /// <param name="s">The value to store</param> public static void c4key_addMapKey(C4Key *key, string s) { using(var s_ = new C4String(s)) { c4key_addMapKey(key, s_.AsC4Slice()); } }
public static bool c4blob_keyFromString(string str, C4BlobKey *x) { using (var str_ = new C4String(str)) { return(NativeRaw.c4blob_keyFromString(str_.AsFLSlice(), x)); } }
public static C4Database *c4db_openNamed(string name, C4DatabaseConfig2 *config, C4Error *outError) { using (var name_ = new C4String(name)) { return(NativeRaw.c4db_openNamed(name_.AsFLSlice(), config, outError)); } }
public static int c4doc_purgeRevision(C4Document *doc, string revID, C4Error *outError) { using (var revID_ = new C4String(revID)) { return(NativeRaw.c4doc_purgeRevision(doc, revID_.AsFLSlice(), outError)); } }
public static void FLMutableArray_SetString(FLMutableArray x, uint index, string str) { using (var str_ = new C4String(str)) { NativeRaw.FLMutableArray_SetString(x, index, (FLSlice)str_.AsFLSlice()); } }
public static bool c4doc_setExpiration(C4Database *db, string docId, long timestamp, C4Error *outError) { using (var docId_ = new C4String(docId)) { return(NativeRaw.c4doc_setExpiration(db, docId_.AsFLSlice(), timestamp, outError)); } }
public static void FLMutableDict_SetBool(FLMutableDict x, string key, bool b) { using (var key_ = new C4String(key)) { NativeRaw.FLMutableDict_SetBool(x, (FLSlice)key_.AsFLSlice(), b); } }
public static C4Document *c4doc_get(C4Database *database, string docID, bool mustExist, C4Error *outError) { using (var docID_ = new C4String(docID)) { return(NativeRaw.c4doc_get(database, docID_.AsFLSlice(), mustExist, outError)); } }
public static void FLMutableDict_SetUInt(FLMutableDict x, string key, ulong u) { using (var key_ = new C4String(key)) { NativeRaw.FLMutableDict_SetUInt(x, (FLSlice)key_.AsFLSlice(), u); } }
public static bool c4doc_selectNextPossibleAncestorOf(C4Document *doc, string revID) { using (var revID_ = new C4String(revID)) { return(NativeRaw.c4doc_selectNextPossibleAncestorOf(doc, revID_.AsFLSlice())); } }
public static void FLMutableDict_SetFloat(FLMutableDict x, string key, float f) { using (var key_ = new C4String(key)) { NativeRaw.FLMutableDict_SetFloat(x, (FLSlice)key_.AsFLSlice(), f); } }
public static C4Query *c4query_new(C4Database *database, string expression, C4Error *error) { using (var expression_ = new C4String(expression)) { return(NativeRaw.c4query_new(database, expression_.AsFLSlice(), error)); } }
public static void FLMutableDict_SetDouble(FLMutableDict x, string key, double d) { using (var key_ = new C4String(key)) { NativeRaw.FLMutableDict_SetDouble(x, (FLSlice)key_.AsFLSlice(), d); } }
public static bool c4db_deleteIndex(C4Database *database, string name, C4Error *outError) { using (var name_ = new C4String(name)) { return(NativeRaw.c4db_deleteIndex(database, name_.AsFLSlice(), outError)); } }
public static void FLMutableDict_SetValue(FLMutableDict x, string key, FLValue *value) { using (var key_ = new C4String(key)) { NativeRaw.FLMutableDict_SetValue(x, (FLSlice)key_.AsFLSlice(), value); } }
public static bool c4key_setDefaultFullTextLanguage(string languageName, bool stripDiacriticals) { using (var languageName_ = new C4String(languageName)) { return(NativeRaw.c4key_setDefaultFullTextLanguage(languageName_.AsC4Slice(), stripDiacriticals)); } }
public static void FLMutableDict_Remove(FLMutableDict x, string key) { using (var key_ = new C4String(key)) { NativeRaw.FLMutableDict_Remove(x, (FLSlice)key_.AsFLSlice()); } }
public static C4Key *c4key_newGeoJSON(string geoJSON, C4GeoArea boundingArea) { using (var geoJSON_ = new C4String(geoJSON)) { return(NativeRaw.c4key_newGeoJSON(geoJSON_.AsC4Slice(), boundingArea)); } }
public static FLMutableDict FLMutableDict_GetMutableDict(FLMutableDict x, string key) { using (var key_ = new C4String(key)) { return(NativeRaw.FLMutableDict_GetMutableDict(x, (FLSlice)key_.AsFLSlice())); } }
public static C4Database *c4db_open(string path, C4DatabaseConfig *config, C4Error *outError) { using (var path_ = new C4String(path)) { return(NativeRaw.c4db_open(path_.AsC4Slice(), config, outError)); } }
public CBForestDocument(string docId, string revId) { _docID = new C4String(docId); _revID = new C4String(revId); }