pub struct Database { /* private fields */ }
Expand description

A connection to a couchbase-lite database.

Implementations

Begin a new transaction, the transaction defaults to rolling back when it is dropped. If you want the transaction to commit, you must call Transaction::commit

Returns the number of (undeleted) documents in the database

Return existing document from database

Compiles a query from an expression given as JSON. The expression is a predicate that describes which documents should be returned. A separate, optional sort expression describes the ordering of the results.

Compiles a query from an expression given as N1QL.

Creates an enumerator ordered by docID.

Register a database observer, with a callback that will be invoked after the database changes. The callback will be called once, after the first change. After that it won’t be called again until all of the changes have been read by calling Database::observed_changes.

Remove all database observers

Get observed changes for this database

Intialize socket implementation for replication (builtin couchbase-lite websocket library)

starts database replication

  • reset - If true, the replicator will reset its checkpoint and start replication from the beginning.
  • validation_cb - Callback that can reject incoming revisions. Arguments: collection_name, doc_id, rev_id, rev_flags, doc_body. It should return false to reject document.
  • repl_status_changed - Callback to be invoked when replicator’s status changes.
  • repl_docs_ended - Callback notifying status of individual documents.

restart database replicator, gives error if Database::start_replicator haven’t called yet

restart database replicator with new auth information, gives error if Database::start_replicator haven’t called yet

  • reset - If true, the replicator will reset its checkpoint and start replication from the beginning.

stop database replication

Get shared “fleece” encoder, &mut self to make possible exists only one session

Returns the names of all indexes in the database

Creates a database index, of the values of specific expressions across all documents. The name is used to identify the index for later updating or deletion; if an index with the same name already exists, it will be replaced unless it has the exact same expressions. Note: If some documents are missing the values to be indexed, those documents will just be omitted from the index. It’s not an error.

Returns the name of the database, as given to c4db_openNamed. This is the filename without the “.cblite2” extension.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.