RuntimeModelAdapter class
Model adapter that uses a database that runs only in the memory of the application. All data will be reset when the application is re-launched.
It is usually used for temporary databases under development or for testing.
Normally, a common database sharedDatabase is used for the entire app, but if you want to reset the database each time, for example for testing, pass an individual database to database.
By passing data to initialValue, the database can be used as a data mockup since it contains data in advance.
By adding prefix, all paths can be prefixed, enabling operations such as separating data storage locations for each Flavor.
If validator is specified, validation is performed in the database.
Specify networkDelay to simulate communication delay.
アプリのメモリ上でのみ動作するデータベースを利用したモデルアダプター。
アプリを立ち上げ直すとデータはすべてリセットされます。
通常は開発途中の仮のデータベースやテスト用のデータベースに利用します。
通常はアプリ内全体での共通のデータベースsharedDatabaseが利用されますが、テスト用などで毎回データベースをリセットする場合はdatabaseに個別のデータベースを渡してください。
initialValueにデータを渡すことで予めデータが入った状態でデータベースを利用することができるためデータモックとして利用することができます。
prefixを追加することですべてのパスにプレフィックスを付与することができ、Flavorごとにデータの保存場所を分けるなどの運用が可能です。
validatorを指定するとデータベース内でのバリデーションが行われます。
networkDelayを指定すると通信の遅延をシミュレートすることができます。
- Inheritance
-
- Object
- ModelAdapter
- RuntimeModelAdapter
- Available Extensions
- Annotations
Constructors
-
RuntimeModelAdapter({NoSqlDatabase? database, List<
ModelInitialValue> ? initialValue, String? prefix, DatabaseValidator? validator, Duration? networkDelay}) -
Model adapter that uses a database that runs only in the memory of the application.
All data will be reset when the application is re-launched.
const
Properties
- availableListen → bool
-
no setteroverride
- database → NoSqlDatabase
-
Designated database. Please use for testing purposes, etc.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
-
initialValue
→ List<
ModelInitialValue> ? -
Actual data when used as a mock-up.
final
- networkDelay → Duration?
-
Delay time to simulate communication delays.
final
- prefix → String?
-
Path prefix.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- validator → DatabaseValidator?
-
Specify the permission validator for the database.
final
Methods
-
clearAll(
) → Future< void> -
Delete all data in the database.
override
-
deleteDocument(
ModelAdapterDocumentQuery query) → Future< void> -
Delete data from the platform set by the adapter by passing
query
.override -
deleteOnBatch(
ModelBatchRef ref, ModelAdapterDocumentQuery query) → void -
Describe the data deletion process when performing a batch.
override
-
deleteOnTransaction(
ModelTransactionRef ref, ModelAdapterDocumentQuery query) → void -
Describe the data deletion process when performing a transaction.
override
-
disposeCollection(
ModelAdapterCollectionQuery query) → void -
The associated collection is discarded by passing
query
.override -
disposeDocument(
ModelAdapterDocumentQuery query) → void -
The destruction of related documents is handled by passing
query
.override -
listenCollection(
ModelAdapterCollectionQuery query) → Future< List< StreamSubscription> > -
Pass
query
to monitor the collection.override -
listenDocument(
ModelAdapterDocumentQuery query) → Future< List< StreamSubscription> > -
Pass
query
to monitor the document.override -
loadAggregation<
T> (ModelAdapterCollectionQuery query, ModelAggregateQuery< AsyncAggregateValue> aggregateQuery) → Future<T?> -
Aggregate queries against data collections to retrieve data.
override
-
loadCollection(
ModelAdapterCollectionQuery query) → Future< Map< String, DynamicMap> > -
Pass
query
to the platform set by the adapter to retrieve the collection.override -
loadDocument(
ModelAdapterDocumentQuery query) → Future< DynamicMap> -
Pass
query
to the platform set by the adapter to retrieve the document.override -
loadOnTransaction(
ModelTransactionRef ref, ModelAdapterDocumentQuery query) → FutureOr< DynamicMap> -
Describe the data acquisition process when performing a transaction.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
runBatch(
FutureOr< void> batch(ModelBatchRef ref), int splitLength) → FutureOr<void> -
Processes a batch for execution.
override
-
runTransaction(
FutureOr< void> transaction(ModelTransactionRef ref)) → FutureOr<void> -
Do the processing to execute the transaction.
override
-
saveDocument(
ModelAdapterDocumentQuery query, DynamicMap value) → Future< void> -
By passing the
query
and thevalue
to be stored, the data is stored on the platform set by the adapter.override -
saveOnBatch(
ModelBatchRef ref, ModelAdapterDocumentQuery query, DynamicMap value) → void -
Describe the data storage process when performing a batch.
override
-
saveOnTransaction(
ModelTransactionRef ref, ModelAdapterDocumentQuery query, DynamicMap value) → void -
Describes the data storage process when performing a transaction.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Properties
-
A common database throughout the application.
final