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

Side by Side Diff: service/datastore/context.go

Issue 2353063004: Add "MkKeyContext" KeyContext generation function. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « service/datastore/checkfilter_test.go ('k') | service/datastore/context_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package datastore 5 package datastore
6 6
7 import ( 7 import (
8 "github.com/luci/gae/service/info" 8 "github.com/luci/gae/service/info"
9 9
10 "golang.org/x/net/context" 10 "golang.org/x/net/context"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 newFilts := make([]RawFilter, 0, len(cur)+len(filts)) 83 newFilts := make([]RawFilter, 0, len(cur)+len(filts))
84 newFilts = append(newFilts, getCurFilters(c)...) 84 newFilts = append(newFilts, getCurFilters(c)...)
85 newFilts = append(newFilts, filts...) 85 newFilts = append(newFilts, filts...)
86 return context.WithValue(c, rawDatastoreFilterKey, newFilts) 86 return context.WithValue(c, rawDatastoreFilterKey, newFilts)
87 } 87 }
88 88
89 // GetKeyContext returns the KeyContext whose AppID and Namespace match those 89 // GetKeyContext returns the KeyContext whose AppID and Namespace match those
90 // installed in the supplied Context. 90 // installed in the supplied Context.
91 func GetKeyContext(c context.Context) KeyContext { 91 func GetKeyContext(c context.Context) KeyContext {
92 ri := info.Raw(c) 92 ri := info.Raw(c)
93 » return KeyContext{ri.FullyQualifiedAppID(), ri.GetNamespace()} 93 » return MkKeyContext(ri.FullyQualifiedAppID(), ri.GetNamespace())
94 } 94 }
OLDNEW
« no previous file with comments | « service/datastore/checkfilter_test.go ('k') | service/datastore/context_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698