CsvCollectionSourceModelAdapter class

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を指定するとデータベース内でのバリデーションが行われます。

The first line is treated as a header and the strings listed there as keys.

The elements of a row are the documents, and each row forms a collection.

1行目をヘッダーとして扱い、そこに記載されている文字列をキーとして扱います。

行の要素がドキュメントとなり、行ごとにコレクションが形成されます。

id,name,age
1,John,20
2,Tom,30
3,Alice,40

->

{
  "1": {
    "id": 1,
    "name": "John",
    "age": 20
  },
  "2": {
    "id": 2,
    "name": "Tom",
    "age": 30
  },
  "3": {
    "id": 3,
    "name": "Alice",
    "age": 40
  }
}
Inheritance
Available Extensions
Annotations

Constructors

CsvCollectionSourceModelAdapter({List<ModelInitialValue>? initialValue, NoSqlDatabase? database, String? collectionPath, required String source, required String idKey, Map<String, String>? requestHeaders, String? requestMethod, String skipIdPrefix = "#"})
A database adapter that uses CSV files as a data source.
const

Properties

availableListen bool
no setterinherited
collectionPath String?
The path of the destination as a collection.
finalinherited
database NoSqlDatabase
Designated database.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
idKey String
Key of the column to be used as the ID.
final
initialValue List<ModelInitialValue>?
Actual data when used as a mock-up.
finalinherited
requestHeaders Map<String, String>?
A request header sent when making a request as HTTP.
finalinherited
requestMethod String?
A request method sent when making a request as HTTP.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
skipIdPrefix String
Prefix for the value of idKey when skipping that row.
final
source String
Data source.
finalinherited
validator DatabaseValidator?
Specify the permission validator for the database.
finalinherited

Methods

clearAll() Future<void>
Delete all data in the database.
inherited
deleteDocument(ModelAdapterDocumentQuery query) Future<void>
Delete data from the platform set by the adapter by passing query.
inherited
deleteOnBatch(ModelBatchRef ref, ModelAdapterDocumentQuery query) → void
Describe the data deletion process when performing a batch.
inherited
deleteOnTransaction(ModelTransactionRef ref, ModelAdapterDocumentQuery query) → void
Describe the data deletion process when performing a transaction.
inherited
disposeCollection(ModelAdapterCollectionQuery query) → void
The associated collection is discarded by passing query.
inherited
disposeDocument(ModelAdapterDocumentQuery query) → void
The destruction of related documents is handled by passing query.
inherited
fromCsv(List<List> csv) Map<String, DynamicMap>
CSV data List can be retrieved in NoSqlDatabase Map.
override
listenCollection(ModelAdapterCollectionQuery query) Future<List<StreamSubscription>>
Pass query to monitor the collection.
inherited
listenDocument(ModelAdapterDocumentQuery query) Future<List<StreamSubscription>>
Pass query to monitor the document.
inherited
loadAggregation<T>(ModelAdapterCollectionQuery query, ModelAggregateQuery<AsyncAggregateValue> aggregateQuery) Future<T?>
Aggregate queries against data collections to retrieve data.
inherited
loadCollection(ModelAdapterCollectionQuery query) Future<Map<String, DynamicMap>>
Pass query to the platform set by the adapter to retrieve the collection.
inherited
loadDocument(ModelAdapterDocumentQuery query) Future<DynamicMap>
Pass query to the platform set by the adapter to retrieve the document.
inherited
loadOnTransaction(ModelTransactionRef ref, ModelAdapterDocumentQuery query) FutureOr<DynamicMap>
Describe the data acquisition process when performing a transaction.
inherited
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.
inherited
runTransaction(FutureOr<void> transaction(ModelTransactionRef ref)) FutureOr<void>
Do the processing to execute the transaction.
inherited
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.
inherited
saveOnBatch(ModelBatchRef ref, ModelAdapterDocumentQuery query, DynamicMap value) → void
Describe the data storage process when performing a batch.
inherited
saveOnTransaction(ModelTransactionRef ref, ModelAdapterDocumentQuery query, DynamicMap value) → void
Describes the data storage process when performing a transaction.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited