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

Unified Diff: service/datastore/multiarg.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: WithoutTransaction, comments, fixes, cleanup. Created 4 years, 3 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/multiarg.go
diff --git a/service/datastore/multiarg.go b/service/datastore/multiarg.go
index 13bc3f02e74d2e294af0081402378dc5671bb69b..4a68366514731eeb14dee3ea021570b0855b5f77 100644
--- a/service/datastore/multiarg.go
+++ b/service/datastore/multiarg.go
@@ -41,8 +41,8 @@ type multiArgType struct {
newElem func() reflect.Value
}
-func (mat *multiArgType) getKey(aid, ns string, slot reflect.Value) (*Key, error) {
- return newKeyObjErr(aid, ns, mat.getMGS(slot))
+func (mat *multiArgType) getKey(kc KeyContext, slot reflect.Value) (*Key, error) {
+ return newKeyObjErr(kc, mat.getMGS(slot))
}
func (mat *multiArgType) getPM(slot reflect.Value) (PropertyMap, error) {
@@ -237,7 +237,7 @@ func mustParseArg(et reflect.Type, sliceArg bool) *multiArgType {
panic(fmt.Errorf("invalid argument type: %s is not a PLS or pointer-to-struct", et))
}
-func newKeyObjErr(aid, ns string, mgs MetaGetterSetter) (*Key, error) {
+func newKeyObjErr(kc KeyContext, mgs MetaGetterSetter) (*Key, error) {
if key, _ := GetMetaDefault(mgs, "key", nil).(*Key); key != nil {
return key, nil
}
@@ -255,7 +255,7 @@ func newKeyObjErr(aid, ns string, mgs MetaGetterSetter) (*Key, error) {
// get parent
par, _ := GetMetaDefault(mgs, "parent", nil).(*Key)
- return NewKey(aid, ns, kind, sid, iid, par), nil
+ return kc.NewKey(kind, sid, iid, par), nil
}
func isOKSingleType(t reflect.Type, allowKey bool) error {
@@ -401,8 +401,8 @@ func (mma *metaMultiArg) iterator(cb metaMultiArgIteratorCallback) *metaMultiArg
}
}
-// getKeysPMs returns the
-func (mma *metaMultiArg) getKeysPMs(aid, ns string, meta bool) ([]*Key, []PropertyMap, error) {
+// getKeysPMs returns the keys and PropertyMap for the supplied argument items.
+func (mma *metaMultiArg) getKeysPMs(kc KeyContext, meta bool) ([]*Key, []PropertyMap, error) {
var et errorTracker
it := mma.iterator(et.init(mma))
@@ -415,7 +415,7 @@ func (mma *metaMultiArg) getKeysPMs(aid, ns string, meta bool) ([]*Key, []Proper
for i := 0; i < mma.count; i++ {
it.next(func(mat *multiArgType, slot reflect.Value) error {
- key, err := mat.getKey(aid, ns, slot)
+ key, err := mat.getKey(kc, slot)
if err != nil {
return err
}

Powered by Google App Engine
This is Rietveld 408576698