| Index: service/datastore/datastore.go
|
| diff --git a/service/datastore/datastore.go b/service/datastore/datastore.go
|
| index 17305e57901d7eb5e996175a3c524d5531fde2d2..752c99c55779e02a2f97cced14b351645f18a6af 100644
|
| --- a/service/datastore/datastore.go
|
| +++ b/service/datastore/datastore.go
|
| @@ -52,6 +52,26 @@ func (d *datastoreImpl) NewKeyToks(toks []KeyTok) *Key {
|
| return NewKeyToks(d.aid, d.ns, toks)
|
| }
|
|
|
| +// PopulateKey loads key into obj.
|
| +//
|
| +// obj is any object that Interface.Get is able to accept.
|
| +//
|
| +// 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) {
|
| + lst := key.LastTok()
|
| + if lst.StringID != "" {
|
| + pls.SetMeta("id", lst.StringID)
|
| + } else {
|
| + pls.SetMeta("id", lst.IntID)
|
| + }
|
| + pls.SetMeta("kind", lst.Kind)
|
| + pls.SetMeta("parent", key.Parent())
|
| + }
|
| +}
|
| +
|
| func runParseCallback(cbIface interface{}) (isKey, hasErr, hasCursorCB bool, mat multiArgType) {
|
| badSig := func() {
|
| panic(fmt.Errorf(
|
|
|