Documentation ¶
Index ¶
- func RegisterNodeDataDecoder(typ string, f func(bytes []byte) (interface{}, error))
- type EachOrder
- type Node
- func (this *Node) AddChild(id string, typ string, data interface{}) (added *Node, err error)
- func (this *Node) AddChildData(data ...NodeData) (added []*Node, err error)
- func (this *Node) Children() []*Node
- func (this *Node) Data() interface{}
- func (this *Node) Each(order EachOrder, f func(node *Node, depth int) bool, maxDepth ...int)
- func (this *Node) Id() string
- func (this *Node) MustAddChild(id string, typ string, data interface{}) (added *Node)
- func (this *Node) Parent() *Node
- func (this *Node) SetData(typ string, data interface{}) *Node
- func (this *Node) Type() string
- type NodeData
- type Tree
- func (this *Tree) AddNode(pid, id string, typ string, data interface{}) (added *Node, err error)
- func (this *Tree) Each(order EachOrder, f func(node *Node, depth int) bool, maxDepth ...int)
- func (this *Tree) GetNode(id string) (node *Node)
- func (this *Tree) MustAddNode(pid, id string, typ string, data interface{}) (added *Node)
- func (this *Tree) Root() *Node
- func (this *Tree) Update()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterNodeDataDecoder ¶
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AddChildData ¶
func (*Node) Each ¶
遍历节点及其所有子孙节点。
order: 排序方式。 PreOrder=前序遍历; PostOrder=后序遍历。 f: 回调函数,如果 f 返回 false,则会中止遍历。 depth: 当前遍历深度,从 0 开始累加。 maxDepth: 最大遍历深度。
func (*Node) MustAddChild ¶
type Tree ¶
type Tree struct { Name string `json:"name,omitempty"` // contains filtered or unexported fields }
func (*Tree) Each ¶
遍历节点及其所有子孙节点。
order: 排序方式。 PreOrder=前序遍历; PostOrder=后序遍历。 f: 回调函数,如果 f 返回 false,则会中止遍历。 depth: 当前遍历深度,从 0 开始累加。 maxDepth: 最大遍历深度。
func (*Tree) MustAddNode ¶
Click to show internal directories.
Click to hide internal directories.