AsyncDatabase class abstract interface Database

A Database with a primarily asynchronous API.

Implemented types

Constructors

AsyncDatabase()

Properties

config DatabaseConfiguration
The configuration which was used to open this database.
no setterinherited
count Future<int>
The total number of documents in the database.
no setteroverride
defaultCollection Future<AsyncCollection>
The default Collection of this database.
no setteroverride
defaultScope Future<AsyncScope>
The default Scope of this database.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
indexes Future<List<String>>
The names of all existing indexes.
no setteroverride
isClosed bool
Whether this resource has been closed.
no setterinherited
name String
The name of this database.
no setterinherited
path String?
The path to this database.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scopes Future<List<AsyncScope>>
The Scopes of this database.
no setteroverride

Methods

addChangeListener(DatabaseChangeListener listener) Future<ListenerToken>
Adds a listener to be notified of all changes to Documents in this database.
override
addDocumentChangeListener(String id, DocumentChangeListener listener) Future<ListenerToken>
Adds a listener to be notified of changes to the Document with the given id.
override
changeEncryptionKey(EncryptionKey? newKey) Future<void>
Encrypts or decrypts a Database, or changes its EncryptionKey.
override
changes() AsyncListenStream<DatabaseChange>
Returns a Stream to be notified of all changes to Documents in this database.
override
close() Future<void>
Closes this database.
inherited
collection(String name, [String scope = Scope.defaultName]) Future<AsyncCollection?>
Returns the Collection with the given name in the given scope.
override
collections([String scope = Scope.defaultName]) Future<List<AsyncCollection>>
Returns all the Collections in the given scope.
override
createCollection(String name, [String scope = Scope.defaultName]) Future<AsyncCollection>
Creates a Collection with the given name in the specified scope.
override
createIndex(String name, Index index) Future<void>
Creates a value or full-text search index with the given name.
override
createQuery(String query, {bool json = false}) Future<AsyncQuery>
Creates a Query from a query string.
override
delete() Future<void>
Closes and deletes this database.
inherited
deleteCollection(String name, [String scope = Scope.defaultName]) Future<void>
Deletes the Collection with the given name in the given scope.
override
deleteDocument(Document document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) Future<bool>
Deletes a document from this database, resolving conflicts through ConcurrencyControl.
override
deleteIndex(String name) Future<void>
Deletes the Index of the given name.
override
deleteTypedDocument(TypedDocumentObject<Object> document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) Future<bool>
Deletes a typed document from this database, resolving conflicts through ConcurrencyControl.
override
document(String id) Future<Document?>
Returns the Document with the given id, if it exists.
override
documentChanges(String id) AsyncListenStream<DocumentChange>
Returns a Stream to be notified of changes to the Document with the given id.
override
getBlob(Map<String, Object?> properties) Future<Blob?>
Gets a Blob using its metadata.
override
getDocumentExpiration(String id) Future<DateTime?>
Gets the expiration date of a Document by its id, if it exists.
override
inBatch(FutureOr<void> fn()) Future<void>
Runs a group of database operations in a batch.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performMaintenance(MaintenanceType type) Future<void>
Performs database maintenance.
override
purgeDocument(Document document) Future<void>
Purges a document from this database.
override
purgeDocumentById(String id) Future<void>
Purges a Document from this database by its id.
override
purgeTypedDocument(TypedDocumentObject<Object> document) Future<void>
Purges a typed document from this database.
override
removeChangeListener(ListenerToken token) Future<void>
Removes a previously added change listener.
override
saveBlob(Blob blob) Future<void>
Saves a Blob directly into this database without associating it with any Documents.
override
saveDocument(MutableDocument document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) Future<bool>
Saves a document to this database, resolving conflicts through ConcurrencyControl.
override
saveDocumentWithConflictHandler(MutableDocument document, SaveConflictHandler conflictHandler) Future<bool>
Saves a document to this database, resolving conflicts with a conflictHandler.
override
saveTypedDocument<D extends TypedDocumentObject<Object>, MD extends TypedMutableDocumentObject<TypedDocumentObject<Object>, TypedDocumentObject<Object>>>(TypedMutableDocumentObject<D, MD> document) AsyncSaveTypedDocument<D, MD>
Creates and returns an object, which can be used to save a typed document to this database.
override
scope(String name) Future<AsyncScope?>
Returns the Scope with the given name.
override
setDocumentExpiration(String id, DateTime? expiration) Future<void>
Sets an expiration date for a Document by its id.
override
toString() String
A string representation of this object.
inherited
typedDocument<D extends TypedDocumentObject<Object>>(String id) Future<D?>
Returns the typed document, with type D and the given id, if it exists.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String id) Future<DocumentFragment>
Returns the DocumentFragment for the Document with the given id.
override

Static Methods

copy({required String from, required String name, DatabaseConfiguration? config}) Future<void>
Copies a canned database from the given path to a new database with the given name and config.
override
exists(String name, {String? directory}) Future<bool>
Checks whether a database of the given name exists in the given directory or not.
override
open(String name, [DatabaseConfiguration? config]) Future<AsyncDatabase>
Opens a Couchbase Lite database with the given name and config, which executes in a separate worker isolate.
remove(String name, {String? directory}) Future<void>
Deletes a database of the given name in the given directory.
override