Main purpose of the library is to match arrays of bytes, this is why every node keeps its value as a single byte
$ go get -u github.com/fakefloordiv/triego
BuildTree(branches [][]byte) Leaf
- build a tree with provided branches. Returned
Leaf
struct is a base leaf
- build a tree with provided branches. Returned
InsertOne(base Leaf, branch []byte) Leaf
- insert a new branch to the tree. Returned
Leaf
is modified base
- insert a new branch to the tree. Returned
InsertMany(base Leaf, branches [][]byte)
- same as just
Insert
, but allows you to insert multiple branches at once
- same as just
NewWalker(root Leaf) Walker
- returns a new walker interface
Walker
(interface)Walk(data []byte) (lastLeaf Leaf, err bool)
- walks by a tree, starting with a node last time was the last one. Returns the last one node that was matched and bool that determines whether everything is ok (in case of false, returned leaf is the last one node that was matching an input stream)
Leaf
(node struct)IsTail() bool
- determines whether current node may be a finishing node (contains a tail node as a child)