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

Side by Side Diff: lib/src/datastore_impl.dart

Issue 1520863002: Implement support for converting db values to datastore values with db.Query.filter (Closed) Base URL: git@github.com:dart-lang/gcloud.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/db/db.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library gcloud.datastore_impl; 5 library gcloud.datastore_impl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:http/http.dart' as http; 9 import 'package:http/http.dart' as http;
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 305 }
306 pf.operator = operator; 306 pf.operator = operator;
307 pf.property = new api.PropertyReference()..name = filter.name; 307 pf.property = new api.PropertyReference()..name = filter.name;
308 308
309 // FIXME(Issue #5): Is this OK? 309 // FIXME(Issue #5): Is this OK?
310 var value = filter.value; 310 var value = filter.value;
311 if (filter.relation == datastore.FilterRelation.In) { 311 if (filter.relation == datastore.FilterRelation.In) {
312 if (value is List && value.length == 1) { 312 if (value is List && value.length == 1) {
313 value = value.first; 313 value = value.first;
314 } else { 314 } else {
315 throw new ArgumentError('List values not supported'); 315 throw new ArgumentError('List values not supported (was: $value).');
316 } 316 }
317 } 317 }
318 318
319 pf.value = _convertDatastore2ApiPropertyValue(value, true, lists: false); 319 pf.value = _convertDatastore2ApiPropertyValue(value, true, lists: false);
320 return new api.Filter()..propertyFilter = pf; 320 return new api.Filter()..propertyFilter = pf;
321 } 321 }
322 322
323 api.Filter _convertDatastoreAncestorKey2ApiFilter(datastore.Key key) { 323 api.Filter _convertDatastoreAncestorKey2ApiFilter(datastore.Key key) {
324 var pf = new api.PropertyFilter(); 324 var pf = new api.PropertyFilter();
325 pf.operator = 'HAS_ANCESTOR'; 325 pf.operator = 'HAS_ANCESTOR';
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 return new Future.sync(() { 701 return new Future.sync(() {
702 throw new ArgumentError('Cannot call next() on last page.'); 702 throw new ArgumentError('Cannot call next() on last page.');
703 }); 703 });
704 } 704 }
705 705
706 return QueryPageImpl.runQuery( 706 return QueryPageImpl.runQuery(
707 _api, _project, _nextRequest, _remainingNumberOfEntities) 707 _api, _project, _nextRequest, _remainingNumberOfEntities)
708 .catchError(DatastoreImpl._handleError); 708 .catchError(DatastoreImpl._handleError);
709 } 709 }
710 } 710 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/db/db.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698