Database
Constructors
Types
Functions
Adds a change listener for the changes that occur in the database.
Adds a change listener for the changes that occur in the database with a CoroutineContext that will be used to launch coroutines the listener will be called on. Coroutines will be launched in a CoroutineScope that is canceled when the listener is removed.
Adds a change listener for the changes that occur in the database with a CoroutineScope that will be used to launch coroutines the listener will be called on. The listener is removed when the scope is canceled.
Adds a change listener for the changes that occur to the specified document.
Adds a change listener for the changes that occur to the specified document with a CoroutineContext that will be used to launch coroutines the listener will be called on. Coroutines will be launched in a CoroutineScope that is canceled when the listener is removed.
Adds a change listener for the changes that occur to the specified document with a CoroutineScope that will be used to launch coroutines the listener will be called on. The listener is removed when the scope is canceled.
Add an index to the database.
Create a SQL++ query.
A Flow of database changes.
Deletes a database. Deleting a database will stop all replicators, live queries and all listeners attached to it. Although attempting to close a closed database is not an error, attempting to delete a closed database is.
Deletes a document from the database. When write operations are executed concurrently, the last writer will overwrite all other written values. Calling this function is the same as calling the delete(Document, ConcurrencyControl) function with LAST_WRITE_WINS concurrency control.
Deletes a document from the database. When used with lastWriteWins concurrency control, the last write operation will win if there is a conflict. When used with FAIL_ON_CONFLICT concurrency control, delete will fail with 'false' value returned.
Delete the named index from the database.
A Flow of document changes.
Gets document fragment object by the given document ID.
Gets an existing Document object with the given ID. If the document with the given ID doesn't exist in the database, the value returned will be null.
Returns the expiration time of the document. null will be returned if there is no expiration time set
Get a list of the names of indices on the database.
Runs a group of database operations in a batch. Use this when performing bulk write operations like multiple inserts/updates; it saves the overhead of multiple database commits, greatly improving performance.
Performs database maintenance.
Purges the given document from the database. This is more drastic than delete(Document), it removes all traces of the document. The purge will NOT be replicated to other databases.
Purges the given document id for the document in database. This is more drastic than delete(Document), it removes all traces of the document. The purge will NOT be replicated to other databases.
Removes the change listener added to the database.
Saves a document to the database. When write operations are executed concurrently, the last writer will overwrite all other written values. Calling this method is the same as calling the ave(MutableDocument, ConcurrencyControl) method with LAST_WRITE_WINS concurrency control.
Saves a document to the database. When used with LAST_WRITE_WINS concurrency control, the last write operation will win if there is a conflict. When used with FAIL_ON_CONFLICT concurrency control, save will fail with false value
Saves a document to the database. Conflicts will be resolved by the passed ConflictHandler. When write operations are executed concurrently and if conflicts occur, the conflict handler will be called. Use the conflict handler to directly edit the document to resolve the conflict. When the conflict handler returns 'true', the save method will save the edited document as the resolved document. If the conflict handler returns 'false', the save operation will be canceled with 'false' value returned as the conflict wasn't resolved.
Sets an expiration date on a document. After this time, the document will be purged from the database.