| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |