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

Unified Diff: go/src/infra/gae/epservice/example/service_add.go

Issue 1227183003: Change RawDatastore to do less reflection. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@move_dummy
Patch Set: fix No/ShouldIndex Created 5 years, 5 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
« no previous file with comments | « no previous file | go/src/infra/gae/epservice/example/service_cas.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/gae/epservice/example/service_add.go
diff --git a/go/src/infra/gae/epservice/example/service_add.go b/go/src/infra/gae/epservice/example/service_add.go
index 46064977add4f2c5bfea553187db16a4c48ba5ec..db939ca87de6149a078126fc0cadb220a69b51ea 100644
--- a/go/src/infra/gae/epservice/example/service_add.go
+++ b/go/src/infra/gae/epservice/example/service_add.go
@@ -6,7 +6,9 @@ package example
import (
"golang.org/x/net/context"
+
"infra/gae/libs/gae"
+ "infra/gae/libs/gae/helper"
"infra/gae/libs/gae/prod"
"github.com/GoogleCloudPlatform/go-endpoints/endpoints"
@@ -37,14 +39,15 @@ func (Example) Add(c context.Context, r *AddReq) (rsp *AddRsp, err error) {
err = gae.GetRDS(c).RunInTransaction(func(c context.Context) error {
rds := gae.GetRDS(c)
ctr := &Counter{}
+ pls := helper.GetPLS(ctr)
key := rds.NewKey("Counter", r.Name, 0, nil)
- if err := rds.Get(key, ctr); err != nil && err != gae.ErrDSNoSuchEntity {
+ if err := rds.Get(key, pls); err != nil && err != gae.ErrDSNoSuchEntity {
return err
}
rsp.Prev = ctr.Val
ctr.Val += r.Delta
rsp.Cur = ctr.Val
- _, err := rds.Put(key, ctr)
+ _, err := rds.Put(key, pls)
return err
}, nil)
return
« no previous file with comments | « no previous file | go/src/infra/gae/epservice/example/service_cas.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698