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

Unified Diff: go/src/infra/gae/epservice/example/service_list.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
Index: go/src/infra/gae/epservice/example/service_list.go
diff --git a/go/src/infra/gae/epservice/example/service_list.go b/go/src/infra/gae/epservice/example/service_list.go
index 23c41195f450c4125c1e66eb35d15b7a26b0cc58..52ab18cb9f0650dd4f227619336215bd10ce5988 100644
--- a/go/src/infra/gae/epservice/example/service_list.go
+++ b/go/src/infra/gae/epservice/example/service_list.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"
@@ -23,10 +25,17 @@ type ListRsp struct {
func (Example) List(c context.Context) (rsp *ListRsp, err error) {
rds := gae.GetRDS(prod.Use(c))
rsp = &ListRsp{}
- _, err = rds.GetAll(rds.NewQuery("Counter"), &rsp.Counters)
+ dst := []gae.DSPropertyMap{}
+ _, err = rds.GetAll(rds.NewQuery("Counter"), &dst)
if err != nil {
return
}
+ rsp.Counters = make([]Counter, len(dst))
+ for i, m := range dst {
+ if err = helper.GetPLS(rsp.Counters[i]).Load(m); err != nil {
+ return
+ }
+ }
return
}
« no previous file with comments | « go/src/infra/gae/epservice/example/service_currentvalue.go ('k') | go/src/infra/gae/libs/gae/dummy/dummy.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698