MCPcopy
hub / github.com/cayleygraph/cayley / Next

Method Next

graph/sql/iterator.go:263–301  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

261}
262
263func (it *iteratorNext) Next(ctx context.Context) bool {
264 if it.err != nil {
265 return false
266 }
267 if it.cursor == nil {
268 it.cursor, it.err = it.qs.Query(ctx, it.query)
269 }
270 // TODO(dennwc): this loop exists only because of nextPath workaround
271 for {
272 if it.err != nil {
273 return false
274 }
275 if it.nextPathRes != nil {
276 it.res = it.nextPathRes
277 it.tags = it.nextPathTags
278 it.nextPathRes = nil
279 it.nextPathTags = nil
280 return true
281 }
282 if !it.cursor.Next() {
283 it.err = it.cursor.Err()
284 it.cursor.Close()
285 return false
286 }
287
288 prev := it.res
289 if !it.scanValue(it.cursor) {
290 return false
291 }
292 if !it.query.nextPath {
293 return true
294 }
295 if prev == nil || prev.Key() != it.res.Key() {
296 return true
297 }
298 // skip the same main key if in nextPath mode
299 // the user should receive accept those results via NextPath of the iterator
300 }
301}
302
303func (it *iteratorNext) NextPath(ctx context.Context) bool {
304 if it.err != nil {

Callers

nothing calls this directly

Calls 6

QueryMethod · 0.80
scanValueMethod · 0.80
NextMethod · 0.65
ErrMethod · 0.65
CloseMethod · 0.65
KeyMethod · 0.65

Tested by

no test coverage detected