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

Unified Diff: impl/memory/datastore_data.go

Issue 1358063003: Add Kind/StringID/IntID back to Key. (Closed) Base URL: https://github.com/luci/gae.git@add_allocate_ids
Patch Set: Created 5 years, 3 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: impl/memory/datastore_data.go
diff --git a/impl/memory/datastore_data.go b/impl/memory/datastore_data.go
index 96c85f8af98a3ca3eefc7ea20beecf485beb5c03..f563b4ba1e230c5b789facb5c1f2b45ea1485470 100644
--- a/impl/memory/datastore_data.go
+++ b/impl/memory/datastore_data.go
@@ -143,7 +143,7 @@ func (d *dataStoreData) allocateIDs(incomplete *ds.Key, n int) int64 {
func (d *dataStoreData) allocateIDsLocked(ents *memCollection, incomplete *ds.Key, n int) int64 {
idKey := []byte(nil)
if incomplete.Parent() == nil {
- idKey = rootIDsKey(incomplete.Last().Kind)
+ idKey = rootIDsKey(incomplete.Kind())
} else {
idKey = groupIDsKey(incomplete)
}
@@ -153,7 +153,7 @@ func (d *dataStoreData) allocateIDsLocked(ents *memCollection, incomplete *ds.Ke
func (d *dataStoreData) fixKeyLocked(ents *memCollection, key *ds.Key) *ds.Key {
if key.Incomplete() {
id := d.allocateIDsLocked(ents, key, 1)
- key = ds.NewKey(key.AppID(), key.Namespace(), key.Last().Kind, "", id, key.Parent())
+ key = ds.NewKey(key.AppID(), key.Namespace(), key.Kind(), "", id, key.Parent())
}
return key
}

Powered by Google App Engine
This is Rietveld 408576698