iterator

package
v0.0.0-...-79350a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDone = fmt.Errorf("no more items in iterator")

Done is returned by an iterator's Next method when the iteration is complete; when there are no more items to return. Every Iterator type extending Iterator interface must return this error when there are no more items to iterate

Functions

This section is empty.

Types

type ChildIterator

type ChildIterator struct {
	// contains filtered or unexported fields
}

ChildIterator would iterate only it's children and not grandchildren

func (*ChildIterator) Next

func (iter *ChildIterator) Next() (*node.Node, error)

type Iterator

type Iterator interface {
	Next() (*node.Node, error)
}

Every Iterator type must extend this interface while implementing the iterator

func GetChildIterator

func GetChildIterator(nodeObj *node.Node) Iterator

func GetTreeIterator

func GetTreeIterator(nodeObj *node.Node) Iterator

type ParentIterator

type ParentIterator struct {
	// contains filtered or unexported fields
}

func GetParentIterator

func GetParentIterator(nodeObj *node.Node) *ParentIterator

func (*ParentIterator) Next

func (iter *ParentIterator) Next() (*node.Node, error)

type TreeIterator

type TreeIterator struct {
	// contains filtered or unexported fields
}

TreeIterator would iterate the whole tree or subtree depending on the node passed to the iterator. If root node is passed, whole tree would be iterated else the subtree of given node would be iterated

func (*TreeIterator) Next

func (iter *TreeIterator) Next() (*node.Node, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL