@@ -25,7 +25,7 @@ class Transaction {
2525 static const int _TRANSACTION_COMMITTED = 2 ;
2626
2727 final DatastoreDB db;
28- final datastore .Transaction _datastoreTransaction;
28+ final ds .Transaction _datastoreTransaction;
2929
3030 final List <Model > _inserts = [];
3131 final List <Key > _deletes = [];
@@ -108,30 +108,30 @@ class Transaction {
108108}
109109
110110class Query {
111- final _relationMapping = const < String , datastore .FilterRelation > {
112- '<' : datastore .FilterRelation .LessThan ,
113- '<=' : datastore .FilterRelation .LessThanOrEqual ,
114- '>' : datastore .FilterRelation .GreatherThan ,
115- '>=' : datastore .FilterRelation .GreatherThanOrEqual ,
116- '=' : datastore .FilterRelation .Equal ,
111+ final _relationMapping = const < String , ds .FilterRelation > {
112+ '<' : ds .FilterRelation .LessThan ,
113+ '<=' : ds .FilterRelation .LessThanOrEqual ,
114+ '>' : ds .FilterRelation .GreatherThan ,
115+ '>=' : ds .FilterRelation .GreatherThanOrEqual ,
116+ '=' : ds .FilterRelation .Equal ,
117117 };
118118
119119 final DatastoreDB _db;
120- final datastore .Transaction _transaction;
120+ final ds .Transaction _transaction;
121121 final String _kind;
122122
123123 final Partition _partition;
124124 final Key _ancestorKey;
125125
126- final List <datastore .Filter > _filters = [];
127- final List <datastore .Order > _orders = [];
126+ final List <ds .Filter > _filters = [];
127+ final List <ds .Order > _orders = [];
128128 int _offset;
129129 int _limit;
130130
131131 Query (DatastoreDB dbImpl, Type kind,
132132 {Partition partition,
133133 Key ancestorKey,
134- datastore .Transaction datastoreTransaction})
134+ ds .Transaction datastoreTransaction})
135135 : _db = dbImpl,
136136 _kind = dbImpl.modelDB.kindName (kind),
137137 _partition = partition,
@@ -165,11 +165,11 @@ class Query {
165165 // This is for backwards compatibility: We allow [datastore.Key]s for now.
166166 // TODO: We should remove the condition in a major version update of
167167 // `package:gcloud`.
168- if (comparisonObject is ! datastore .Key ) {
168+ if (comparisonObject is ! ds .Key ) {
169169 comparisonObject = _db.modelDB
170170 .toDatastoreValue (_kind, name, comparisonObject, forComparison: true );
171171 }
172- _filters.add (new datastore .Filter (
172+ _filters.add (new ds .Filter (
173173 _relationMapping[comparison], propertyName, comparisonObject));
174174 }
175175
@@ -182,11 +182,11 @@ class Query {
182182 void order (String orderString) {
183183 // TODO: validate [orderString] (e.g. is name valid)
184184 if (orderString.startsWith ('-' )) {
185- _orders.add (new datastore .Order (datastore .OrderDirection .Decending ,
185+ _orders.add (new ds .Order (ds .OrderDirection .Decending ,
186186 _convertToDatastoreName (orderString.substring (1 ))));
187187 } else {
188- _orders.add (new datastore .Order (datastore. OrderDirection . Ascending ,
189- _convertToDatastoreName (orderString)));
188+ _orders.add (new ds .Order (
189+ ds. OrderDirection . Ascending , _convertToDatastoreName (orderString)));
190190 }
191191 }
192192
@@ -220,7 +220,7 @@ class Query {
220220 if (_ancestorKey != null ) {
221221 ancestorKey = _db.modelDB.toDatastoreKey (_ancestorKey);
222222 }
223- var query = new datastore .Query (
223+ var query = new ds .Query (
224224 ancestorKey: ancestorKey,
225225 kind: _kind,
226226 filters: _filters,
@@ -230,10 +230,10 @@ class Query {
230230
231231 var partition;
232232 if (_partition != null ) {
233- partition = new datastore .Partition (_partition.namespace);
233+ partition = new ds .Partition (_partition.namespace);
234234 }
235235
236- return new StreamFromPages ((int pageSize) {
236+ return new StreamFromPages <ds. Entity > ((int pageSize) {
237237 return _db.datastore
238238 .query (query, transaction: _transaction, partition: partition);
239239 }).stream.map (_db.modelDB.fromDatastoreEntity);
@@ -254,7 +254,7 @@ class Query {
254254}
255255
256256class DatastoreDB {
257- final datastore .Datastore datastore;
257+ final ds .Datastore datastore;
258258 final ModelDB _modelDB;
259259 Partition _defaultPartition;
260260
@@ -356,13 +356,13 @@ class DatastoreDB {
356356Future _commitHelper (DatastoreDB db,
357357 {List <Model > inserts,
358358 List <Key > deletes,
359- datastore .Transaction datastoreTransaction}) {
359+ ds .Transaction datastoreTransaction}) {
360360 var entityInserts, entityAutoIdInserts, entityDeletes;
361361 var autoIdModelInserts;
362362 if (inserts != null ) {
363- entityInserts = [];
364- entityAutoIdInserts = [];
365- autoIdModelInserts = [];
363+ entityInserts = < ds. Entity > [];
364+ entityAutoIdInserts = < ds. Entity > [];
365+ autoIdModelInserts = < Model > [];
366366
367367 for (var model in inserts) {
368368 // If parent was not explicitly set, we assume this model will map to
@@ -388,7 +388,7 @@ Future _commitHelper(DatastoreDB db,
388388 autoIdInserts: entityAutoIdInserts,
389389 deletes: entityDeletes,
390390 transaction: datastoreTransaction)
391- .then ((datastore .CommitResult result) {
391+ .then ((ds .CommitResult result) {
392392 if (entityAutoIdInserts != null && entityAutoIdInserts.length > 0 ) {
393393 for (var i = 0 ; i < result.autoIdInsertKeys.length; i++ ) {
394394 var key = db.modelDB.fromDatastoreKey (result.autoIdInsertKeys[i]);
@@ -400,11 +400,11 @@ Future _commitHelper(DatastoreDB db,
400400}
401401
402402Future <List <Model >> _lookupHelper (DatastoreDB db, List <Key > keys,
403- {datastore .Transaction datastoreTransaction}) {
403+ {ds .Transaction datastoreTransaction}) {
404404 var entityKeys = keys.map (db.modelDB.toDatastoreKey).toList ();
405405 return db.datastore
406406 .lookup (entityKeys, transaction: datastoreTransaction)
407- .then ((List <datastore .Entity > entities) {
407+ .then ((List <ds .Entity > entities) {
408408 return entities.map (db.modelDB.fromDatastoreEntity).toList ();
409409 });
410410}
0 commit comments