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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/db/db.dart
diff --git a/lib/src/db/db.dart b/lib/src/db/db.dart
index 07c5efb7b5ac3b7bafedfcd0da4508e144c370c3..2562f8a852088011c2d5f8b59b939cc40e36a21e 100644
--- a/lib/src/db/db.dart
+++ b/lib/src/db/db.dart
@@ -247,9 +247,10 @@ class DatastoreDB {
final ModelDB _modelDB;
Partition _defaultPartition;
- DatastoreDB(this.datastore, {ModelDB modelDB})
- : _modelDB = modelDB != null ? modelDB : new ModelDBImpl() {
- _defaultPartition = new Partition(null);
+ DatastoreDB(this.datastore, {ModelDB modelDB, Partition defaultPartition}) :
+ _modelDB = modelDB != null ? modelDB : new ModelDBImpl() {
+ _defaultPartition =
+ defaultPartition != null ? defaultPartition : new Partition(null);
}
/**
@@ -325,6 +326,14 @@ class DatastoreDB {
Future commit({List<Model> inserts, List<Key> deletes}) {
return _commitHelper(this, inserts: inserts, deletes: deletes);
}
+
+ /**
+ * Returns a new [DatastoreDB] with the given [defaultPartition].
+ */
+ DatastoreDB replace({Partition defaultPartition}) {
Søren Gjesse 2015/02/19 11:59:51 The method name 'replace' seems somewhat overloade
kustermann 2015/02/19 12:17:11 Another constructor is of no value, since the exis
+ return new DatastoreDB(
+ datastore, modelDB: modelDB, defaultPartition: defaultPartition);
+ }
}
Future _commitHelper(DatastoreDB db,

Powered by Google App Engine
This is Rietveld 408576698