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

Unified Diff: service/datastore/datastore.go

Issue 2048933004: Refactor multiarg, split MGS/PLS. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Rebarse? Created 4 years, 6 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
« no previous file with comments | « no previous file | service/datastore/datastore_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/datastore.go
diff --git a/service/datastore/datastore.go b/service/datastore/datastore.go
index 7b5e4b8b6a5f8a9e82d09504eed4afb2f4a7cc86..375066276565ad044864079f33f66b109ebd82ec 100644
--- a/service/datastore/datastore.go
+++ b/service/datastore/datastore.go
@@ -59,16 +59,19 @@ func (d *datastoreImpl) NewKeyToks(toks []KeyTok) *Key {
// This method will panic if obj is an invalid datastore model. If the key could
// not be applied to the object, nothing will happen.
func PopulateKey(obj interface{}, key *Key) {
- pls := getMGS(obj)
- if !pls.SetMeta("key", key) {
+ populateKeyMGS(getMGS(obj), key)
+}
+
+func populateKeyMGS(mgs MetaGetterSetter, key *Key) {
+ if !mgs.SetMeta("key", key) {
lst := key.LastTok()
if lst.StringID != "" {
- pls.SetMeta("id", lst.StringID)
+ mgs.SetMeta("id", lst.StringID)
} else {
- pls.SetMeta("id", lst.IntID)
+ mgs.SetMeta("id", lst.IntID)
}
- pls.SetMeta("kind", lst.Kind)
- pls.SetMeta("parent", key.Parent())
+ mgs.SetMeta("kind", lst.Kind)
+ mgs.SetMeta("parent", key.Parent())
}
}
« no previous file with comments | « no previous file | service/datastore/datastore_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698