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

Treats a CSV with a sequence of keys and values as a document. It cannot be used as a collection.

If direction is set to Axis.horizontal, data can be defined in the horizontal direction.

If direction is set to Axis.vertical, data can be defined in the vertical direction.

The offset of the data can be specified with offset.

キーと値が並んだCSVをドキュメントとして扱います。コレクションとしては利用できません。

directionAxis.horizontalにすると横方向にデータを定義できます。

directionAxis.verticalにすると縦方向にデータを定義できます。

offsetでデータのオフセットを指定できます。

// Horizontal
id,name,age
1,John,20

// Vertical
id,1
name,John
age,20

->

{
  "id": 1,
  "name": "John",
  "age": 20
}
Inheritance
Available Extensions
Annotations

Constructors

CsvDocumentSourceModelAdapter({List<ModelInitialValue>? initialValue, NoSqlDatabase? database, String? collectionPath, String? documentId, required String source, Offset? offset, Axis direction = Axis.horizontal, Map<String, String>? requestHeaders, String? requestMethod})
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
direction Axis
Direction in which data is read.
final
documentId String?
ID as a document.
final
hashCode int
The hash code for this object.
no setterinherited
initialValue List<ModelInitialValue>?
Actual data when used as a mock-up.
finalinherited
offset Offset?
Offset of XY axis.
final
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
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.
override
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.
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.
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