Move current result handling out of Base
Delete majority of Base functionality.
This commit is contained in:
parent
ee6d4c8db7
commit
375d953d93
14 changed files with 140 additions and 82 deletions
|
|
@ -39,6 +39,7 @@ type Iterator struct {
|
|||
isAll bool
|
||||
constraint bson.M
|
||||
collection string
|
||||
result graph.Value
|
||||
}
|
||||
|
||||
func NewIterator(ts *TripleStore, collection string, d graph.Direction, val graph.Value) *Iterator {
|
||||
|
|
@ -158,10 +159,18 @@ func (it *Iterator) Next() (graph.Value, bool) {
|
|||
}
|
||||
return nil, false
|
||||
}
|
||||
it.Last = result.Id
|
||||
it.result = result.Id
|
||||
return result.Id, true
|
||||
}
|
||||
|
||||
func (it *Iterator) ResultTree() *graph.ResultTree {
|
||||
return graph.NewResultTree(it.Result())
|
||||
}
|
||||
|
||||
func (it *Iterator) Result() graph.Value {
|
||||
return it.result
|
||||
}
|
||||
|
||||
// No subiterators.
|
||||
func (it *Iterator) SubIterators() []graph.Iterator {
|
||||
return nil
|
||||
|
|
@ -170,7 +179,7 @@ func (it *Iterator) SubIterators() []graph.Iterator {
|
|||
func (it *Iterator) Check(v graph.Value) bool {
|
||||
graph.CheckLogIn(it, v)
|
||||
if it.isAll {
|
||||
it.Last = v
|
||||
it.result = v
|
||||
return graph.CheckLogOut(it, v, true)
|
||||
}
|
||||
var offset int
|
||||
|
|
@ -186,7 +195,7 @@ func (it *Iterator) Check(v graph.Value) bool {
|
|||
}
|
||||
val := v.(string)[offset : it.ts.hasher.Size()*2+offset]
|
||||
if val == it.hash {
|
||||
it.Last = v
|
||||
it.result = v
|
||||
return graph.CheckLogOut(it, v, true)
|
||||
}
|
||||
return graph.CheckLogOut(it, v, false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue