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

Unified Diff: service/datastore/pls_impl.go

Issue 1289323002: Fix miscellaneous prod bugs. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Remove superfluous function added in PS#1. 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
Index: service/datastore/pls_impl.go
diff --git a/service/datastore/pls_impl.go b/service/datastore/pls_impl.go
index 717156c90238a3259535b83ba4da6d9fb44e7cc0..d6867a18491dc450b071589036fb13d8225d77ae 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{MkProperty(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]

Powered by Google App Engine
This is Rietveld 408576698