CollectionModelQuery class

Query class for defining Model.

It is possible to define the path to be queried and other necessary conditions.

By specifying adapter, you can change the behavior when reading and saving data. If no adapter is specified, ModelAdapter.primary is used.

If accessQuery is specified, you can specify endpoints, etc. in ModelAdapter.

If validationQueries is specified, you can specify the data validation of the model to be used.

Use DocumentModelQuery for documents.

Execute create to create a DocumentModelQuery with the specified ID.

The following elements can be specified by chaining equal, notEqual, lessThanOrEqual, greaterThanOrEqual, contains, containsAny, where, notWhere, isNull, isNotNull, like , geo, orderByAsc, orderByDesc, and limitTo can be specified in a chain to filter elements.

Modelを定義するためのクエリクラス。

クエリ対象となるpathと他必要な条件を定義することが可能です。

adapterを指定することでデータの読取・保存の際の挙動を変えることができます。adapterは何も指定されない場合ModelAdapter.primaryが使用されます。

accessQueryを指定した場合、ModelAdapterでのエンドポイント等を指定できます。

validationQueriesを指定した場合、利用するモデルのデータバリデーションを指定できます。

ドキュメントに対してはDocumentModelQueryを使用してください。

createを実行すると指定したIDを持つDocumentModelQueryを作成することができます。

equalnotEquallessThanOrEqualgreaterThanOrEqualcontainscontainsAnywherenotWhereisNullisNotNulllikegeoorderByAscorderByDesclimitToをチェインして指定していくことにより要素のフィルタリングが可能です。

Inheritance
Available Extensions
Annotations

Constructors

CollectionModelQuery(String path, {ModelAdapter? adapter, ModelAccessQuery? accessQuery, List<ModelValidationQuery>? validationQueries})
Query class for defining Model.
const

Properties

accessQuery ModelAccessQuery?
Stores information for connecting to the server.
finalinherited
adapter ModelAdapter
An adapter for defining the process of reading and saving data. If adapter is not specified, ModelAdapter.primary is used.
no setterinherited
filters List<ModelQueryFilter>
Filter definition for the model.
finalinherited
hashCode int
The hash code for this object.
no setteroverride
path String
Path definition for the model.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validationQueries List<ModelValidationQuery>?
Query for data validation.
finalinherited

Methods

collectionGroup() CollectionModelQuery
Including this will cause this collection to be treated as a collection group.
contains(String key, Object? value) CollectionModelQuery
You can filter only those elements whose value is contained in the array for key.
containsAny(String key, List<Object>? values) CollectionModelQuery
Only elements whose array for key contains one of the values in values can be filtered.
copyWith({String? path, ModelAdapter? adapter, ModelAccessQuery? accessQuery, List<ModelValidationQuery>? validationQueries}) CollectionModelQuery
Copy CollectionModelQuery with path, adapter, accessQuery and validationQueries.
create<T>([String? id]) DocumentModelQuery
Create a DocumentModelQuery for a document under a collection using its own path and id.
equal(String key, Object? value) CollectionModelQuery
You can filter only those elements for which the value for key matches the value for value.
geo(String key, List<String>? geoHash) CollectionModelQuery
Only elements that contain positional information for key within the range of the geoHash array can be filtered.
greaterThan(String key, Object? value) CollectionModelQuery
Only elements whose value for key is greater than value can be filtered.
greaterThanOrEqual(String key, Object? value) CollectionModelQuery
Only elements whose value for key is greater than value (including equal values) can be filtered.
hasMatchAsList(List<DynamicMap> data) bool
Runs hasMatchAsMap recursively in List and returns true if one of the matches is found.
inherited
hasMatchAsMap(DynamicMap? data) bool
Pass filters through data and return true if all conditions are met.
inherited
hasMatchAsObject(Object? data) bool
Ignores ModelQueryFilter.key and returns true if it is within all of the conditions in filters.
inherited
isNotNull(String key) CollectionModelQuery
Only elements whose value for key is not Null can be filtered.
isNull(String key) CollectionModelQuery
Only elements with a value of Null for key can be filtered.
lessThan(String key, Object? value) CollectionModelQuery
Only elements whose value for key is less than value can be filtered.
lessThanOrEqual(String key, Object? value) CollectionModelQuery
Only elements whose value for key is less than value (including equal values) can be filtered.
like(String key, String? text) CollectionModelQuery
You can filter only elements that contain the text of text in the text for key.
limitTo(int value) CollectionModelQuery
Limit the number of elements to value.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notEqual(String key, Object? value) CollectionModelQuery
You can filter only those elements whose value for key does not match the value for value.
notifyDocumentChanges() CollectionModelQuery
Ensure that the collection is notified of changes to internal documents.
notWhere(String key, List<Object>? values) CollectionModelQuery
You can filter only those elements in the values array that do not contain any of the values for key.
orderByAsc(String key) CollectionModelQuery
Sort ascending order on the elements of key.
orderByDesc(String key) CollectionModelQuery
Sort descending order on the elements of key.
remove(ModelQueryFilterType type) CollectionModelQuery
Remove filters related to type.
reset() CollectionModelQuery
Reset all filters.
seekIndex(List<MapEntry<String, DynamicMap>> sorted, DynamicMap data) int?
The position where data enters is retrieved by searching from sorted according to the sort setting of filters.
inherited
sort(List<MapEntry<String, DynamicMap>> data) List<MapEntry<String, DynamicMap>>
Sort data according to the settings in filters.
inherited
toString() String
A string representation of this object.
override
where(String key, List<Object>? values) CollectionModelQuery
You can filter only those elements in the values array that contain one of the values for key.

Operators

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