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を作成することができます。
equal、notEqual、lessThanOrEqual、greaterThanOrEqual、contains、containsAny、where、notWhere、isNull、isNotNull、like、geo、orderByAsc、orderByDesc、limitToをチェインして指定していくことにより要素のフィルタリングが可能です。
- Inheritance
-
- Object
- ModelQuery
- CollectionModelQuery
- 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 forkey
. -
containsAny(
String key, List< Object> ? values) → CollectionModelQuery -
Only elements whose array for
key
contains one of the values invalues
can be filtered. -
copyWith(
{String? path, ModelAdapter? adapter, ModelAccessQuery? accessQuery, List< ModelValidationQuery> ? validationQueries}) → CollectionModelQuery -
Copy CollectionModelQuery with
path
,adapter
,accessQuery
andvalidationQueries
. -
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 forvalue
. -
geo(
String key, List< String> ? geoHash) → CollectionModelQuery -
Only elements that contain positional information for
key
within the range of thegeoHash
array can be filtered. -
greaterThan(
String key, Object? value) → CollectionModelQuery -
Only elements whose value for
key
is greater thanvalue
can be filtered. -
greaterThanOrEqual(
String key, Object? value) → CollectionModelQuery -
Only elements whose value for
key
is greater thanvalue
(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 returntrue
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 thanvalue
can be filtered. -
lessThanOrEqual(
String key, Object? value) → CollectionModelQuery -
Only elements whose value for
key
is less thanvalue
(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 forkey
. -
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 forvalue
. -
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 forkey
. -
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< sorted, DynamicMap data) → int?String, DynamicMap> > -
The position where
data
enters is retrieved by searching fromsorted
according to the sort setting of filters.inherited -
sort(
List< MapEntry< data) → List<String, DynamicMap> >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 forkey
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override