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

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

Issue 937133002: Add DatastoreDB.replace({defaultPartition}) (Closed) Base URL: git@github.com:dart-lang/gcloud.git@master
Patch Set: Addressed comments Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('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 part of gcloud.db; 5 part of gcloud.db;
6 6
7 /** 7 /**
8 * A function definition for transactional functions. 8 * A function definition for transactional functions.
9 * 9 *
10 * The function will be given a [Transaction] object which can be used to make 10 * The function will be given a [Transaction] object which can be used to make
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 240 }
241 return propertyName; 241 return propertyName;
242 } 242 }
243 } 243 }
244 244
245 class DatastoreDB { 245 class DatastoreDB {
246 final datastore.Datastore datastore; 246 final datastore.Datastore datastore;
247 final ModelDB _modelDB; 247 final ModelDB _modelDB;
248 Partition _defaultPartition; 248 Partition _defaultPartition;
249 249
250 DatastoreDB(this.datastore, {ModelDB modelDB}) 250 DatastoreDB(this.datastore, {ModelDB modelDB, Partition defaultPartition}) :
251 : _modelDB = modelDB != null ? modelDB : new ModelDBImpl() { 251 _modelDB = modelDB != null ? modelDB : new ModelDBImpl() {
252 _defaultPartition = new Partition(null); 252 _defaultPartition =
253 defaultPartition != null ? defaultPartition : new Partition(null);
253 } 254 }
254 255
255 /** 256 /**
256 * The [ModelDB] used to serialize/deserialize objects. 257 * The [ModelDB] used to serialize/deserialize objects.
257 */ 258 */
258 ModelDB get modelDB => _modelDB; 259 ModelDB get modelDB => _modelDB;
259 260
260 /** 261 /**
261 * Gets the empty key using the default [Partition]. 262 * Gets the empty key using the default [Partition].
262 * 263 *
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 374
374 Future<List<Model>> _lookupHelper( 375 Future<List<Model>> _lookupHelper(
375 DatastoreDB db, List<Key> keys, 376 DatastoreDB db, List<Key> keys,
376 {datastore.Transaction datastoreTransaction}) { 377 {datastore.Transaction datastoreTransaction}) {
377 var entityKeys = keys.map(db.modelDB.toDatastoreKey).toList(); 378 var entityKeys = keys.map(db.modelDB.toDatastoreKey).toList();
378 return db.datastore.lookup(entityKeys, transaction: datastoreTransaction) 379 return db.datastore.lookup(entityKeys, transaction: datastoreTransaction)
379 .then((List<datastore.Entity> entities) { 380 .then((List<datastore.Entity> entities) {
380 return entities.map(db.modelDB.fromDatastoreEntity).toList(); 381 return entities.map(db.modelDB.fromDatastoreEntity).toList();
381 }); 382 });
382 } 383 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698