YustDatabaseServiceMocked class
A mock database service for storing docs.
- Inheritance
-
- Object
- YustDatabaseService
- YustDatabaseServiceMocked
Constructors
- YustDatabaseServiceMocked.mocked({OnChangeCallback? onChange, required String envCollectionName, required bool useSubcollections})
Properties
- authClient → Client
-
finalinherited
-
db
→ Map<
String, List< Map< >String, dynamic> > -
no setter
- dbLogCallback ↔ DatabaseLogCallback?
-
getter/setter pairinherited
- envCollectionName → String
-
Represents the collection name for the tenants.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxRetries ↔ num
-
Maximum number of retries for a request.
getter/setter pairinherited
- rootUrl → String
-
Root (aka base) URL for the Firestore REST/GRPC API.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statistics ↔ YustDatabaseStatistics
-
getter/setter pairinherited
- useSubcollections → bool
-
If useSubcollections is set to true (default), Yust is creating Subcollections for each tenant automatically.
finalinherited
Methods
-
avg<
T extends YustDoc> (YustDocSetup< T> docSetup, String fieldPath, {List<YustFilter> ? filters, int? limit}) → Future<double> -
Returns the sum over a field of multiple documents in a collection.
override
-
beginTransaction(
) → Future< String> -
Begins a transaction.
inherited
-
clearDb(
) → void -
commitEmptyTransaction(
String transaction) → Future< void> -
inherited
-
commitTransaction(
String transaction, YustDocSetup< YustDoc> docSetup, YustDoc doc, {bool useUpdateMask = false}) → Future<void> -
Saves a YustDoc and finishes a transaction.
inherited
-
count<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, int? limit}) → Future<int> -
Counts the number of documents in a collection.
override
-
deleteDoc<
T extends YustDoc> (YustDocSetup< T> docSetup, T doc) → Future<void> -
Delete a YustDoc.
override
-
deleteDocById<
T extends YustDoc> (YustDocSetup< T> docSetup, String id) → Future<void> -
Delete a YustDoc by the ID.
override
-
deleteDocs<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters}) → Future<void> -
Delete all YustDocs in the filter.
inherited
-
deleteDocsAsBatch<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy, int? limit}) → Future<int> -
Delete all YustDocs in the filter as a batch.
inherited
-
get<
T extends YustDoc> (YustDocSetup< T> docSetup, String id) → Future<T?> -
Returns a YustDoc from the server, if available, otherwise from the cache.
The cached documents may not be up to date!
override
-
getFirst<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy}) → Future<T?> -
Returns the first YustDoc in a list from the server, if available, otherwise from the cache.
The cached documents may not be up to date!
override
-
getFirstFromCache<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy}) → Future<T?> -
Returns the first YustDoc in a list from the cache, if available, otherwise from the server.
Be careful: The cached documents may not be up to date!
override
-
getFirstFromDB<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy}) → Future<T?> -
Returns the first YustDoc in a list directly from the server.
override
-
getFirstStream<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy}) → Stream<T?> -
Returns a stream of the first YustDoc in a list.
override
-
getFromCache<
T extends YustDoc> (YustDocSetup< T> docSetup, String id) → Future<T?> -
Returns a YustDoc from the cache, if available, otherwise from the server.
Be careful: The cached documents may not be up to date!
override
-
getFromDB<
T extends YustDoc> (YustDocSetup< T> docSetup, String id, {String? transaction}) → Future<T?> -
Returns a YustDoc directly from the server.
override
-
getList<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy, int? limit}) → Future<List< T> > -
Returns YustDocs from the server, if available, otherwise from the cache.
The cached documents may not be up to date!
override
-
getListChunked<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy, int pageSize = 300}) → Stream<T> -
Returns YustDocs as a lazy, chunked Stream from the database.
override
-
getListFromCache<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy, int? limit}) → Future<List< T> > -
Returns YustDocs from the cache, if available, otherwise from the server.
Be careful: The cached documents may not be up to date!
override
-
getListFromDB<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy, int? limit}) → Future<List< T> > -
Returns YustDocs directly from the database.
override
-
getListStream<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy, int? limit}) → Stream<List< T> > -
Returns a stream of a YustDocs.
override
-
getQuery<
T extends YustDoc> (YustDocSetup< T> docSetup, {List<YustFilter> ? filters, List<YustOrderBy> ? orderBy, int? limit, String? startAfterDocument}) → RunQueryRequest -
inherited
-
getStream<
T extends YustDoc> (YustDocSetup< T> docSetup, String id) → Stream<T?> -
Returns a stream of a YustDoc.
override
-
initDoc<
T extends YustDoc> (YustDocSetup< T> docSetup, [T? doc]) → T -
Initializes a document with an id and the time it was created.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
runTransactionForDocument<
T extends YustDoc> (YustDocSetup< T> docSetup, String docId, Future<T?> transaction(T doc), {int maxTries = 20, bool ignoreTransactionErrors = false, bool useUpdateMask = false}) → Future<(bool, T?)> -
Reads a document, executes a function and saves the document as a transaction.
Returns true if the transaction was successful.
override
-
saveDoc<
T extends YustDoc> (YustDocSetup< T> docSetup, T doc, {bool? merge = true, bool? trackModification, bool skipOnSave = false, bool? removeNullValues, List<String> ? updateMask, bool skipLog = false, bool doNotCreate = false}) → Future<void> -
Saves a document.
override
-
saveNewDoc<
T extends YustDoc> (YustDocSetup< T> docSetup, {required T doc, Future<void> onInitialised(T)?, bool? removeNullValues}) → Future<T> -
Initializes a YustDoc and saves it.
inherited
-
sum<
T extends YustDoc> (YustDocSetup< T> docSetup, String fieldPath, {List<YustFilter> ? filters, int? limit}) → Future<double> -
Returns the sum over a field of multiple documents in a collection.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
transformDoc<
T extends YustDoc> (YustDocSetup< T> docSetup, dynamic document) → T? -
Transforms a json to a YustDoc
inherited
-
updateDocByTransform<
T extends YustDoc> (YustDocSetup< T> docSetup, String id, List<YustFieldTransform> fieldTransforms, {bool skipOnSave = false, bool? removeNullValues}) → Future<void> -
Transforms (e.g. increment, decrement) a documents fields.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- onChange ↔ OnChangeCallback?
-
getter/setter pair