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

Unified Diff: service/datastore/finalized_query.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Lightning talk licenses. 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
« no previous file with comments | « service/datastore/dumper/dumper_example_test.go ('k') | service/datastore/interface.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/finalized_query.go
diff --git a/service/datastore/finalized_query.go b/service/datastore/finalized_query.go
index d2762881e04008c69e6b2674d3c17c45ff20d4ed..0f9d755ba66c3037ad3a2dc7dde8b40e5905aa09 100644
--- a/service/datastore/finalized_query.go
+++ b/service/datastore/finalized_query.go
@@ -312,8 +312,8 @@ func (q *FinalizedQuery) String() string {
return q.GQL()
}
-// Valid returns true iff this FinalizedQuery is valid in the provided appID and
-// namespace.
+// Valid returns true iff this FinalizedQuery is valid in the provided
+// KeyContext's App ID and Namespace.
//
// This checks the ancestor filter (if any), as well as the inequality filters
// if they filter on '__key__'.
@@ -321,17 +321,17 @@ func (q *FinalizedQuery) String() string {
// In particular, it does NOT validate equality filters which happen to have
// values of type PTKey, nor does it validate inequality filters that happen to
// have values of type PTKey (but don't filter on the magic '__key__' field).
-func (q *FinalizedQuery) Valid(aid, ns string) error {
+func (q *FinalizedQuery) Valid(kc KeyContext) error {
anc := q.Ancestor()
- if anc != nil && (!anc.Valid(false, aid, ns) || anc.IsIncomplete()) {
+ if anc != nil && (!anc.Valid(false, kc) || anc.IsIncomplete()) {
return ErrInvalidKey
}
if q.ineqFiltProp == "__key__" {
- if q.ineqFiltLowSet && !q.ineqFiltLow.Value().(*Key).Valid(false, aid, ns) {
+ if q.ineqFiltLowSet && !q.ineqFiltLow.Value().(*Key).Valid(false, kc) {
return ErrInvalidKey
}
- if q.ineqFiltHighSet && !q.ineqFiltHigh.Value().(*Key).Valid(false, aid, ns) {
+ if q.ineqFiltHighSet && !q.ineqFiltHigh.Value().(*Key).Valid(false, kc) {
return ErrInvalidKey
}
}
« no previous file with comments | « service/datastore/dumper/dumper_example_test.go ('k') | service/datastore/interface.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698