Documentation
¶
Index ¶
- type Node
- type NodeCategory
- type Tree
- func (t *Tree) Add(category NodeCategory, parentIndex int, messages []string) int
- func (t *Tree) AddBreak(parentIndex int) int
- func (t *Tree) AddDebug(parentIndex int, message string) int
- func (t *Tree) AddError(parentIndex int, message string) int
- func (t *Tree) AddInfo(parentIndex int, message string) int
- func (t *Tree) AddMessage(parentIndex int, message string) int
- func (t *Tree) AddMessages(parentIndex int, messages []string) int
- func (t *Tree) AddParent(parentIndex int, message string) int
- func (t *Tree) AddWarn(parentIndex int, message string) int
- func (t Tree) Display()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// Category is the type of node being added.
// - Messages: a slice of messages to add to the node
// - Empty: a line break to add to the node.
// - Parent: the very top level node of the tree.
Category NodeCategory
// contains filtered or unexported fields
}
Node represents a single node of the tree
func NewNode ¶
func NewNode(category NodeCategory, parentIndex int, message []string) Node
NewNode creates a new node with the given parameters
- category: the type of node (Parent, Messages, or Empty)
- parentIndex: the index of the parent node that this new node will belong to
- messages: a slice of messages to display
type NodeCategory ¶
type NodeCategory int
NodeCategory represents which type of node should be added to the tree
- Messages: 0
- Line break: 1
- Parent: 2
const ( // Messages represents a node with 1 or more message Messages NodeCategory = iota // Empty represents an empty node, which is used for line breaks Empty // Parent represents the tree's outer node. Parent )
type Tree ¶
type Tree struct {
// Nodes is a slice containing every Node in the tree.
Nodes []*Node
}
Tree represents the full tree, containing all of the child nodes.
func NewTree ¶
NewNode creates a new Tree. Returns an instance of the tree, and the index of the parent node
func (*Tree) Add ¶
func (t *Tree) Add(category NodeCategory, parentIndex int, messages []string) int
Add is a low level function to create and appends a node to the tree. Returns the index of the new node.
- category: the type of node to add (Parent, Messages, or Empty)
- parentIndex: the index of the parent node that this new node will belong to
- message: the message to display.
func (*Tree) AddBreak ¶
AddBreak adds a line break to the tree
- parentIndex: the index of the parent node that this new node will belong to
func (*Tree) AddDebug ¶
AddDebug adds a debug message to the tree. Returns the index of the new tree.
- parentIndex: the index of the parent node that this new node will belong to
- message: the message to display.
func (*Tree) AddError ¶
AddError adds an error message to the tree. Returns the index of the new tree.
- parentIndex: the index of the parent node that this new node will belong to
- message: the message to display.
func (*Tree) AddInfo ¶
AddInfo adds an info message to the tree. Returns the index of the new tree.
- parentIndex: the index of the parent node that this new node will belong to
- message: the message to display.
func (*Tree) AddMessage ¶
AddMessage adds a single message to the tree
- parentIndex: the index of the parent node that this new node will belong to
- message: the message to display.
func (*Tree) AddMessages ¶
AddMessages adds a slice of messages to the tree
- parentIndex: the index of the parent node that this new node will belong to
- messages: a slice of messages to display.
func (*Tree) AddParent ¶
AddParent creates and adds a Parent node to the tree.
- parentIndex: the index of the parent node that this new node will belong to
- message: the message to display.
