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

Unified Diff: service/datastore/checkfilter.go

Issue 1292913002: Split off serialization and key functions to their own packages. (Closed) Base URL: https://github.com/luci/gae.git@make_queries_better
Patch Set: rebase Created 5 years, 4 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 | « impl/prod/datastore_key.go ('k') | service/datastore/checkfilter_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/checkfilter.go
diff --git a/service/datastore/checkfilter.go b/service/datastore/checkfilter.go
index 2dd9ea3b520db3c7221907f96dccbfa41556e849..efbaba116a26762d800123e45dd1ae0ee8277504 100644
--- a/service/datastore/checkfilter.go
+++ b/service/datastore/checkfilter.go
@@ -45,7 +45,7 @@ func (tcf *checkFilter) GetMulti(keys []Key, meta MultiMetaGetter, cb GetMultiCB
}
lme := errors.NewLazyMultiError(len(keys))
for i, k := range keys {
- if KeyIncomplete(k) || !KeyValid(k, true, tcf.aid, tcf.ns) {
+ if k.Incomplete() || !k.Valid(true, tcf.aid, tcf.ns) {
lme.Assign(i, ErrInvalidKey)
}
}
@@ -70,11 +70,7 @@ func (tcf *checkFilter) PutMulti(keys []Key, vals []PropertyMap, cb PutMultiCB)
}
lme := errors.NewLazyMultiError(len(keys))
for i, k := range keys {
- if KeyIncomplete(k) {
- // use NewKey to avoid going all the way down the stack for this check.
- k = NewKey(k.AppID(), k.Namespace(), k.Kind(), "", 1, k.Parent())
- }
- if !KeyValid(k, false, tcf.aid, tcf.ns) {
+ if !k.PartialValid(tcf.aid, tcf.ns) {
lme.Assign(i, ErrInvalidKey)
continue
}
@@ -102,7 +98,7 @@ func (tcf *checkFilter) DeleteMulti(keys []Key, cb DeleteMultiCB) error {
}
lme := errors.NewLazyMultiError(len(keys))
for i, k := range keys {
- if KeyIncomplete(k) || !KeyValid(k, false, tcf.aid, tcf.ns) {
+ if k.Incomplete() || !k.Valid(false, tcf.aid, tcf.ns) {
lme.Assign(i, ErrInvalidKey)
}
}
« no previous file with comments | « impl/prod/datastore_key.go ('k') | service/datastore/checkfilter_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698