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

Side by Side Diff: impl/memory/datastore_query_execution.go

Issue 1380613002: Fix bugs in impl/memory queries. (Closed) Base URL: https://github.com/luci/gae.git@add_appid
Patch Set: Created 5 years, 2 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 | « impl/memory/datastore_index_selection.go ('k') | impl/memory/datastore_query_execution_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 Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package memory 5 package memory
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return newNormalStrategy(rq.aid, rq.ns, cb, head) 137 return newNormalStrategy(rq.aid, rq.ns, cb, head)
138 } 138 }
139 139
140 func parseSuffix(aid, ns string, suffixFormat []ds.IndexColumn, suffix []byte, c ount int) (raw [][]byte, decoded []ds.Property) { 140 func parseSuffix(aid, ns string, suffixFormat []ds.IndexColumn, suffix []byte, c ount int) (raw [][]byte, decoded []ds.Property) {
141 buf := serialize.Invertible(bytes.NewBuffer(suffix)) 141 buf := serialize.Invertible(bytes.NewBuffer(suffix))
142 decoded = make([]ds.Property, len(suffixFormat)) 142 decoded = make([]ds.Property, len(suffixFormat))
143 raw = make([][]byte, len(suffixFormat)) 143 raw = make([][]byte, len(suffixFormat))
144 144
145 err := error(nil) 145 err := error(nil)
146 for i := range decoded { 146 for i := range decoded {
147 » » if count > 0 && i > count { 147 » » if count >= 0 && i >= count {
148 break 148 break
149 } 149 }
150 needInvert := suffixFormat[i].Descending 150 needInvert := suffixFormat[i].Descending
151 151
152 buf.SetInvert(needInvert) 152 buf.SetInvert(needInvert)
153 decoded[i], err = serialize.ReadProperty(buf, serialize.WithoutC ontext, aid, ns) 153 decoded[i], err = serialize.ReadProperty(buf, serialize.WithoutC ontext, aid, ns)
154 memoryCorruption(err) 154 memoryCorruption(err)
155 155
156 offset := len(suffix) - buf.Len() 156 offset := len(suffix) - buf.Len()
157 raw[i] = suffix[:offset] 157 raw[i] = suffix[:offset]
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 impossible(fmt.Errorf("decoded index row doesn't end wit h a Key: %#v", keyProp)) 244 impossible(fmt.Errorf("decoded index row doesn't end wit h a Key: %#v", keyProp))
245 } 245 }
246 246
247 return strategy.handle( 247 return strategy.handle(
248 rawData, decodedProps, keyProp.Value().(*ds.Key), 248 rawData, decodedProps, keyProp.Value().(*ds.Key),
249 getCursorFn(suffix)) 249 getCursorFn(suffix))
250 }) 250 })
251 251
252 return nil 252 return nil
253 } 253 }
OLDNEW
« no previous file with comments | « impl/memory/datastore_index_selection.go ('k') | impl/memory/datastore_query_execution_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698