Simplify Nexter interface
This change allows a Nexter to be used in the same manner as a scanner
using a for graph.Next(it) {} construction.
It is important that graph.Next(it) and any associated it.Result() calls
operate on the same iterator.
This commit is contained in:
parent
f8e28e066e
commit
b1a70d99aa
31 changed files with 168 additions and 233 deletions
|
|
@ -101,10 +101,10 @@ func (it *AllIterator) Clone() graph.Iterator {
|
|||
return out
|
||||
}
|
||||
|
||||
func (it *AllIterator) Next() (graph.Value, bool) {
|
||||
func (it *AllIterator) Next() bool {
|
||||
if !it.open {
|
||||
it.result = nil
|
||||
return nil, false
|
||||
return false
|
||||
}
|
||||
var out []byte
|
||||
out = make([]byte, len(it.iter.Key()))
|
||||
|
|
@ -115,10 +115,10 @@ func (it *AllIterator) Next() (graph.Value, bool) {
|
|||
}
|
||||
if !bytes.HasPrefix(out, it.prefix) {
|
||||
it.Close()
|
||||
return nil, false
|
||||
return false
|
||||
}
|
||||
it.result = out
|
||||
return out, true
|
||||
return true
|
||||
}
|
||||
|
||||
func (it *AllIterator) ResultTree() *graph.ResultTree {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue