A Database with a primarily synchronous API.
- Implemented types
Constructors
- SyncDatabase.new(String name, [DatabaseConfiguration? config])
-
Opens a Couchbase Lite database with the given
name
andconfig
, which executes in the current isolate.factory
Properties
- config → DatabaseConfiguration
-
The configuration which was used to open this database.
no setterinherited
- count → int
-
The total number of documents in the database.
no setteroverride
- defaultCollection → SyncCollection
-
The default Collection of this database.
no setteroverride
- defaultScope → SyncScope
-
The default Scope of this database.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
-
indexes
→ 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
→ List<
SyncScope> -
The Scopes of this database.
no setteroverride
Methods
-
addChangeListener(
DatabaseChangeListener listener) → ListenerToken -
Adds a
listener
to be notified of all changes to Documents in this database.override -
addDocumentChangeListener(
String id, DocumentChangeListener listener) → ListenerToken -
Adds a
listener
to be notified of changes to the Document with the givenid
.override -
changeEncryptionKey(
EncryptionKey? newKey) → void -
Encrypts or decrypts a Database, or changes its EncryptionKey.
override
-
changes(
) → Stream< DatabaseChange> -
Returns a Stream to be notified of all changes to Documents in this
database.
inherited
-
close(
) → Future< void> -
Closes this database.
inherited
-
collection(
String name, [String scope = Scope.defaultName]) → SyncCollection? -
Returns the Collection with the given
name
in the givenscope
.override -
collections(
[String scope = Scope.defaultName]) → List< SyncCollection> -
Returns all the Collections in the given
scope
.override -
createCollection(
String name, [String scope = Scope.defaultName]) → SyncCollection -
Creates a Collection with the given
name
in the specifiedscope
.override -
createIndex(
String name, Index index) → void -
Creates a value or full-text search
index
with the givenname
.override -
createQuery(
String query, {bool json = false}) → SyncQuery -
Creates a Query from a query string.
override
-
delete(
) → Future< void> -
Closes and deletes this database.
inherited
-
deleteCollection(
String name, [String scope = Scope.defaultName]) → void -
Deletes the Collection with the given
name
in the givenscope
.override -
deleteDocument(
Document document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) → bool -
Deletes a
document
from this database, resolving conflicts through ConcurrencyControl.override -
deleteIndex(
String name) → void -
Deletes the Index of the given
name
.override -
deleteTypedDocument(
TypedDocumentObject< Object> document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) → bool -
Deletes a typed
document
from this database, resolving conflicts through ConcurrencyControl.override -
document(
String id) → Document? -
Returns the Document with the given
id
, if it exists.override -
documentChanges(
String id) → Stream< DocumentChange> -
Returns a Stream to be notified of changes to the Document with the
given
id
.inherited -
getBlob(
Map< String, Object?> properties) → Blob? -
Gets a Blob using its metadata.
override
-
getDocumentExpiration(
String id) → 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.
inherited
-
inBatchSync(
void fn()) → void - Runs a group of database operations in a batch, synchronously.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
performMaintenance(
MaintenanceType type) → void -
Performs database maintenance.
override
-
purgeDocument(
Document document) → void -
Purges a
document
from this database.override -
purgeDocumentById(
String id) → void -
Purges a Document from this database by its
id
.override -
purgeTypedDocument(
TypedDocumentObject< Object> document) → void -
Purges a typed
document
from this database.override -
removeChangeListener(
ListenerToken token) → 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]) → bool -
Saves a
document
to this database, resolving conflicts through ConcurrencyControl.override -
saveDocumentWithConflictHandler(
MutableDocument document, SaveConflictHandler conflictHandler) → FutureOr< bool> -
Saves a
document
to this database, resolving conflicts with aconflictHandler
.inherited -
saveDocumentWithConflictHandlerSync(
MutableDocument document, SyncSaveConflictHandler conflictHandler) → bool -
Saves a
document
to this database, resolving conflicts with an syncconflictHandler
. -
saveTypedDocument<
D extends TypedDocumentObject< (Object> , MD extends TypedMutableDocumentObject<TypedDocumentObject< >Object> , TypedDocumentObject<Object> >TypedMutableDocumentObject< D, MD> document) → SyncSaveTypedDocument<D, MD> -
Creates and returns an object, which can be used to save a typed
document
to this database.override -
scope(
String name) → SyncScope? -
Returns the Scope with the given
name
.override -
setDocumentExpiration(
String id, DateTime? expiration) → void -
Sets an
expiration
date for a Document by itsid
.override -
toString(
) → String -
A string representation of this object.
inherited
-
typedDocument<
D extends TypedDocumentObject< (Object> >String id) → D? -
Returns the typed document, with type
D
and the givenid
, if it exists.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String id) → DocumentFragment -
Returns the DocumentFragment for the Document with the given
id
.override
Static Methods
-
copy(
{required String from, required String name, DatabaseConfiguration? config}) → void -
Copies a canned database
from
the given path to a new database with the givenname
andconfig
.override -
exists(
String name, {String? directory}) → bool -
Checks whether a database of the given
name
exists in the givendirectory
or not.override -
remove(
String name, {String? directory}) → void -
Deletes a database of the given
name
in the givendirectory
.override