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

Unified Diff: service/datastore/pls_impl.go

Issue 1289323002: Fix miscellaneous prod bugs. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Rebase. Created 5 years, 4 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 | « service/datastore/pls.go ('k') | service/datastore/pls_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/pls_impl.go
diff --git a/service/datastore/pls_impl.go b/service/datastore/pls_impl.go
index 717156c90238a3259535b83ba4da6d9fb44e7cc0..f6656d3ad92bfe021d460f83a18c7ac7e6e76695 100644
--- a/service/datastore/pls_impl.go
+++ b/service/datastore/pls_impl.go
@@ -250,10 +250,17 @@ func (p *structPLS) Save(withMeta bool) (PropertyMap, error) {
}
ret["$"+k] = []Property{p}
}
+ if _, ok := p.c.byMeta["kind"]; !ok {
+ ret["$kind"] = []Property{MkPropertyNI(p.getDefaultKind())}
+ }
}
return ret, nil
}
+func (p *structPLS) getDefaultKind() string {
+ return p.o.Type().Name()
+}
+
func (p *structPLS) save(propMap PropertyMap, prefix string, is IndexSetting) (idxCount int, err error) {
if err = p.Problem(); err != nil {
return
@@ -324,6 +331,9 @@ func (p *structPLS) GetMeta(key string) (interface{}, error) {
}
idx, ok := p.c.byMeta[key]
if !ok {
+ if key == "kind" {
+ return p.getDefaultKind(), nil
+ }
return nil, ErrMetaFieldUnset
}
st := p.c.byIndex[idx]
« no previous file with comments | « service/datastore/pls.go ('k') | service/datastore/pls_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698