Skip to content

Commit

Permalink
fix: Corrected Enum determination.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Aug 9, 2023
1 parent eaa17f4 commit 64eff68
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
24 changes: 18 additions & 6 deletions packages/masamune/lib/model/model_query_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,18 @@ mixin _ContainsAnyQuerySelectorMixin<T, TQuery extends ModelQueryBase>
/// Only elements whose array for [key] contains one of the values in [values] can be filtered.
///
/// [key]に対する配列に[values]の値のいずれかが含まれる要素のみをフィルタリングすることができます。
TQuery containsAny(List<T>? values) {
TQuery containsAny(List<T?>? values) {
if (values == null) {
return _toQuery(_modelQuery);
}
return _toQuery(
_modelQuery.containsAny(
key,
values.where((e) => e != null).map((e) => e as Object).toList(),
values
.where((e) => e != null)
.cast<T>()
.map((e) => e as Object)
.toList(),
),
);
}
Expand All @@ -182,14 +186,18 @@ mixin _WhereQuerySelectorMixin<T, TQuery extends ModelQueryBase>
/// You can filter only those elements in the [values] array that contain one of the values for [key].
///
/// [values]の配列に[key]に対する値のいずれかが含まれる要素のみをフィルタリングすることができます。
TQuery where(List<T>? values) {
TQuery where(List<T?>? values) {
if (values == null) {
return _toQuery(_modelQuery);
}
return _toQuery(
_modelQuery.where(
key,
values.where((e) => e != null).map((e) => e as Object).toList(),
values
.where((e) => e != null)
.cast<T>()
.map((e) => e as Object)
.toList(),
),
);
}
Expand All @@ -200,14 +208,18 @@ mixin _NotWhereQuerySelectorMixin<T, TQuery extends ModelQueryBase>
/// You can filter only those elements in the [values] array that do not contain any of the values for [key].
///
/// [values]の配列に[key]に対する値のいずれも含まれない要素のみをフィルタリングすることができます。
TQuery notWhere(List<T>? values) {
TQuery notWhere(List<T?>? values) {
if (values == null) {
return _toQuery(_modelQuery);
}
return _toQuery(
_modelQuery.notWhere(
key,
values.where((e) => e != null).map((e) => e as Object).toList(),
values
.where((e) => e != null)
.cast<T>()
.map((e) => e as Object)
.toList(),
),
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/masamune/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ packages:
path: "../katana_router"
relative: true
source: path
version: "2.0.26"
version: "2.0.27"
katana_router_annotation:
dependency: "direct overridden"
description:
path: "../katana_router_annotation"
relative: true
source: path
version: "2.0.15"
version: "2.0.16"
katana_scoped:
dependency: "direct main"
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ String _querySelectorClass(ParamaterValue param, String queryClass) {
return "NumModelQuerySelector<$queryClass>";
} else if (param.type.isDartCoreBool) {
return "BooleanModelQuerySelector<$queryClass>";
} else if (param.type.isDartCoreEnum) {
} else if (param.type.isDartCoreEnum || param.type.element is EnumElement) {
final typeName = param.type.toString().trimStringRight("?");
return "ValueModelQuerySelector<$typeName, $queryClass>";
} else if (param.reference.isNotEmpty) {
Expand Down
12 changes: 6 additions & 6 deletions packages/masamune_builder/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ packages:
path: "../katana_listenables_builder"
relative: true
source: path
version: "2.0.15"
version: "2.0.16"
katana_localization_annotation:
dependency: "direct main"
description:
Expand All @@ -291,7 +291,7 @@ packages:
path: "../katana_localization_builder"
relative: true
source: path
version: "2.0.17"
version: "2.0.18"
katana_prefs_annotation:
dependency: "direct main"
description:
Expand All @@ -305,21 +305,21 @@ packages:
path: "../katana_prefs_builder"
relative: true
source: path
version: "2.0.15"
version: "2.0.16"
katana_router_annotation:
dependency: "direct main"
description:
path: "../katana_router_annotation"
relative: true
source: path
version: "2.0.15"
version: "2.0.16"
katana_router_builder:
dependency: "direct main"
description:
path: "../katana_router_builder"
relative: true
source: path
version: "2.0.21"
version: "2.0.23"
katana_theme_annotation:
dependency: "direct main"
description:
Expand All @@ -333,7 +333,7 @@ packages:
path: "../katana_theme_builder"
relative: true
source: path
version: "2.0.15"
version: "2.0.16"
lints:
dependency: transitive
description:
Expand Down

0 comments on commit 64eff68

Please sign in to comment.