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] |