CsvSourceModelAdapter class abstract

A database adapter that uses CSV files as a data source.

CSV files can be used as configuration files for settings and other purposes.

URL, asset path, or CSV data can be directly specified in source.

requestHeaders specifies request headers to be sent when requesting as HTTP.

requestMethod specifies the request method to be sent when requesting as HTTP.

By passing data to initialValue, the database can be used as a data mockup because it contains data in advance.

If validator is specified, validation is performed in the database.

CSVファイルをデータソースとして利用するデータベースアダプター。

CSVファイルで設定などを行う場合、設定ファイルとして利用することができます。

sourceにはURLやアセットパス、CSVデータを直接指定することができます。

requestHeadersにはHTTPとしてリクエストする際に送るリクエストヘッダーを指定します。

requestMethodにはHTTPとしてリクエストする際に送るリクエストメソッドを指定します。

initialValueにデータを渡すことで予めデータが入った状態でデータベースを利用することができるためデータモックとして利用することができます。

validatorを指定するとデータベース内でのバリデーションが行われます。

CSV data is converted to Map by writing the process for conversion in fromCsv.

fromCsvに変換用の処理を記述することでCSVのデータをMapに変換します。

Inheritance
Implementers
Available Extensions
Annotations

Constructors

CsvSourceModelAdapter({NoSqlDatabase? database, List<ModelInitialValue>? initialValue, required String source, Map<String, String>? requestHeaders, String? requestMethod, String? collectionPath, DatabaseValidator? validator})
A database adapter that uses CSV files as a data source.
const

Properties

availableListen bool
no setteroverride
collectionPath String?
The path of the destination as a collection.
final
database NoSqlDatabase
Designated database.
no setter
hashCode int
The hash code for this object.
no setteroverride
initialValue List<ModelInitialValue>?
Actual data when used as a mock-up.
final
requestHeaders Map<String, String>?
A request header sent when making a request as HTTP.
final
requestMethod String?
A request method sent when making a request as HTTP.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source String
Data source.
final
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
fromCsv(List<List> csv) Map<String, DynamicMap>
CSV data List can be retrieved in NoSqlDatabase Map.
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 the value 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

sharedDatabase NoSqlDatabase
A common database throughout the application.
final