tree

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2017 License: BSD-3-Clause Imports: 3 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

func (*Node) Children added in v0.10.0

func (node *Node) Children() []*Node

func (*Node) Delete

func (parentNode *Node) Delete(path Path) (bool, error)

func (*Node) GetNode

func (currentNode *Node) GetNode(path Path) *Node

Get the node that matches the supplied path.

func (*Node) Insert

func (parentNode *Node) Insert(nodeToInsert *Node) (bool, error)

func (*Node) Level

func (node *Node) Level() int

func (*Node) Name

func (node *Node) Name() string

func (*Node) Parent

func (node *Node) Parent() *Node

func (*Node) SetValue

func (node *Node) SetValue(value interface{})

func (*Node) String

func (node *Node) String() string

func (*Node) Value

func (node *Node) Value() interface{}

func (*Node) Walk added in v0.10.0

func (currentNode *Node) Walk(expression func(node *Node))

Walk visits the current node, then every child of the current node and then recurses down the children.

type Path

type Path []string

func NewPath

func NewPath(component ...string) Path

func RouteToPath

func RouteToPath(route route.Route) Path

func (Path) IsEmpty

func (path Path) IsEmpty() bool

func (Path) IsRootPath

func (path Path) IsRootPath() bool

func (Path) IsValid

func (path Path) IsValid() (bool, error)

Checks whether all components of the current path are valid (not empty, and don't contain slashes).

func (Path) String

func (path Path) String() string

type Tree

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

func Empty

func Empty() *Tree

func New

func New(rootName string, rootValue interface{}) *Tree

func (*Tree) Delete

func (tree *Tree) Delete(path Path) (bool, error)

func (*Tree) GetNode

func (tree *Tree) GetNode(path Path) *Node

Get the node that matches the supplied path.

func (*Tree) Insert

func (tree *Tree) Insert(path Path, value interface{}) (bool, error)

func (*Tree) Root

func (tree *Tree) Root() *Node

func (*Tree) String

func (tree *Tree) String() string

func (*Tree) Walk added in v0.10.0

func (tree *Tree) Walk(expression func(node *Node))

Walk visits every node in the current tree. Starting with the root, every child of the root and then recurses down the children.

Jump to

Keyboard shortcuts

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