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

Unified Diff: impl/cloud/context.go

Issue 2802523002: gae cloud: Use with Datastore (Closed)
Patch Set: review Created 3 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/cloud/context.go
diff --git a/impl/cloud/context.go b/impl/cloud/context.go
index a4b19ea6990e1adbece421ee9dc7bafed5d184c6..bd8fa8e1ad82fc977fc6f2109529acf327c4bb8f 100644
--- a/impl/cloud/context.go
+++ b/impl/cloud/context.go
@@ -51,10 +51,7 @@ func (cfg Config) Use(c context.Context) context.Context {
// datastore service
if cfg.DS != nil {
- cds := cloudDatastore{
- client: cfg.DS,
- }
- c = cds.use(c)
+ c = UseDatastore(c, cfg.DS)
} else {
c = ds.SetRaw(c, dummy.Datastore())
}
@@ -71,3 +68,11 @@ func (cfg Config) Use(c context.Context) context.Context {
return c
}
+
+// UseDatastore installs a datastore implementation into the context.
+func UseDatastore(c context.Context, client *datastore.Client) context.Context {
+ cds := cloudDatastore{
+ client: client,
+ }
+ return cds.use(c)
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698