Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Unified Diff: lib/src/db/db.dart

Issue 2731933004: Remove FilterRelation.In / "property IN" queries, upgrade googleapis{,_beta} dependencies (Closed)
Patch Set: add pubspec.yaml update Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/db/annotations.dart ('k') | lib/src/db/model_db.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/db/db.dart
diff --git a/lib/src/db/db.dart b/lib/src/db/db.dart
index d1a7978339aa3a08dc6336d6c96e467dc3a0d62c..38b88bfbea8b42ca5f26ca676f3d4939bb88319c 100644
--- a/lib/src/db/db.dart
+++ b/lib/src/db/db.dart
@@ -117,7 +117,6 @@ class Query {
'>': datastore.FilterRelation.GreatherThan,
'>=': datastore.FilterRelation.GreatherThanOrEqual,
'=': datastore.FilterRelation.Equal,
- 'IN': datastore.FilterRelation.In,
};
final DatastoreDB _db;
@@ -151,7 +150,6 @@ class Query {
* * '>' (greater than)
* * '>=' (greater than or equal)
* * '=' (equal)
- * * 'IN' (in - `comparisonObject` must be a list)
*
* [comparisonObject] is the object for comparison.
*/
@@ -170,19 +168,8 @@ class Query {
// TODO: We should remove the condition in a major version update of
// `package:gcloud`.
if (comparisonObject is! datastore.Key) {
- var encoded = _db.modelDB.toDatastoreValue(_kind, name, comparisonObject);
-
- // We encode Lists as repeated properties normally, and the encoding of
- // `['abc']` will just be `'abc'` (see [ListProperty]).
- // But for IN filters, we need to treat them as lists.
- if (comparison == 'IN' &&
- comparisonObject is List &&
- comparisonObject.length == 1 &&
- encoded is! List) {
- encoded = [encoded];
- }
-
- comparisonObject = encoded;
+ comparisonObject = _db.modelDB.toDatastoreValue(_kind, name,
+ comparisonObject, forComparison: true);
}
_filters.add(new datastore.Filter(
_relationMapping[comparison], propertyName, comparisonObject));
« no previous file with comments | « lib/src/db/annotations.dart ('k') | lib/src/db/model_db.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698