Move iterators into separate package

Also reduce API exposure and use standard library more - and fix bugs I
previously introduces in mongo.
This commit is contained in:
kortschak 2014-06-30 22:22:50 +09:30
parent 88be6bee37
commit 1768e593a8
62 changed files with 3240 additions and 3130 deletions

View file

@ -25,11 +25,11 @@ func NewResultTree(result TSVal) *ResultTree {
return &ResultTree{result: result}
}
func (t *ResultTree) ToString() string {
func (t *ResultTree) String() string {
base := fmt.Sprintf("(%d", t.result)
if len(t.subtrees) != 0 {
for _, sub := range t.subtrees {
base += fmt.Sprintf(" %s", sub.ToString())
base += fmt.Sprintf(" %s", sub)
}
}
base += ")"
@ -48,11 +48,11 @@ func StringResultTreeEvaluator(it Iterator) string {
if !ok {
break
}
out += it.GetResultTree().ToString()
out += it.GetResultTree().String()
out += "\n"
for it.NextResult() == true {
out += " "
out += it.GetResultTree().ToString()
out += it.GetResultTree().String()
out += "\n"
}
}