| Index: service/datastore/multiarg.go
|
| diff --git a/service/datastore/multiarg.go b/service/datastore/multiarg.go
|
| index cc1a6726510f6817887f6539a42ba276c780e78b..45e78410e3faef8fee3a9ff758c67ccd93fd6ca0 100644
|
| --- a/service/datastore/multiarg.go
|
| +++ b/service/datastore/multiarg.go
|
| @@ -239,16 +239,13 @@ func multiArgTypeInterface() multiArgType {
|
| return newKeyObjErr(aid, ns, slot.Elem().Interface())
|
| },
|
| getPM: func(slot reflect.Value) (PropertyMap, error) {
|
| - pls := mkPLS(slot.Elem().Interface())
|
| - return pls.Save(true)
|
| + return mkPLS(slot.Elem().Interface()).Save(true)
|
| },
|
| getMetaPM: func(slot reflect.Value) PropertyMap {
|
| - pls := getMGS(slot.Elem().Interface())
|
| - return pls.GetAllMeta()
|
| + return getMGS(slot.Elem().Interface()).GetAllMeta()
|
| },
|
| setPM: func(slot reflect.Value, pm PropertyMap) error {
|
| - pls := mkPLS(slot.Elem().Interface())
|
| - return pls.Load(pm)
|
| + return mkPLS(slot.Elem().Interface()).Load(pm)
|
| },
|
| setKey: func(slot reflect.Value, k *Key) {
|
| setKey(slot.Elem().Interface(), k)
|
| @@ -258,37 +255,37 @@ func multiArgTypeInterface() multiArgType {
|
|
|
| func newKeyObjErr(aid, ns string, src interface{}) (*Key, error) {
|
| pls := getMGS(src)
|
| - if key, _ := pls.GetMetaDefault("key", nil).(*Key); key != nil {
|
| + if key, _ := GetMetaDefault(pls, "key", nil).(*Key); key != nil {
|
| return key, nil
|
| }
|
|
|
| // get kind
|
| - kind := pls.GetMetaDefault("kind", "").(string)
|
| + kind := GetMetaDefault(pls, "kind", "").(string)
|
| if kind == "" {
|
| return nil, fmt.Errorf("unable to extract $kind from %T", src)
|
| }
|
|
|
| // get id - allow both to be default for default keys
|
| - sid := pls.GetMetaDefault("id", "").(string)
|
| - iid := pls.GetMetaDefault("id", 0).(int64)
|
| + sid := GetMetaDefault(pls, "id", "").(string)
|
| + iid := GetMetaDefault(pls, "id", 0).(int64)
|
|
|
| // get parent
|
| - par, _ := pls.GetMetaDefault("parent", nil).(*Key)
|
| + par, _ := GetMetaDefault(pls, "parent", nil).(*Key)
|
|
|
| return NewKey(aid, ns, kind, sid, iid, par), nil
|
| }
|
|
|
| func setKey(src interface{}, key *Key) {
|
| pls := getMGS(src)
|
| - if pls.SetMeta("key", key) == ErrMetaFieldUnset {
|
| + if !pls.SetMeta("key", key) {
|
| lst := key.LastTok()
|
| if lst.StringID != "" {
|
| - _ = pls.SetMeta("id", lst.StringID)
|
| + pls.SetMeta("id", lst.StringID)
|
| } else {
|
| - _ = pls.SetMeta("id", lst.IntID)
|
| + pls.SetMeta("id", lst.IntID)
|
| }
|
| - _ = pls.SetMeta("kind", lst.Kind)
|
| - _ = pls.SetMeta("parent", key.Parent())
|
| + pls.SetMeta("kind", lst.Kind)
|
| + pls.SetMeta("parent", key.Parent())
|
| }
|
| }
|
|
|
|
|