Chromium Code Reviews| 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, |