tree

package
v0.0.0-...-ce96b73 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxDepth = 20

Functions

func Builder

func Builder(lookup Lookup) *builder

Tree builder with caching support

Types

type Lookup

type Lookup func(id string) ([]string, error)

type Node

type Node struct {
	Value        string
	Depth        int
	Dependencies []*Node
}

func Create

func Create(rootId string, lookup Lookup) (*Node, error)

func (*Node) Children

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

func (*Node) Leaf

func (n *Node) Leaf() bool

func (*Node) String

func (n *Node) String() string

func (*Node) Trim

func (n *Node) Trim() []Node

Remove all nodes without subtrees and return these nodes. If the node is ignored, if you want to know if the node itself is a leaf use the Leaf() method

type NodeList

type NodeList []*Node

Jump to

Keyboard shortcuts

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