tree

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TreeIt

func TreeIt(ta []TreeAble) []string

Types

type FileItem

type FileItem struct {
	Path string
}

type LevelParentMap

type LevelParentMap struct {
	M map[int]string
}

type Option

type Option struct {
	IgnoreDefault     bool
	TraverseWithCache bool
}

func GetDefaultOption

func GetDefaultOption() *Option

type ParentMap

type ParentMap struct {
	M map[string][]*TreeElem
}

func (*ParentMap) Append

func (pm *ParentMap) Append(p string, item *TreeElem)

type TraverseResultMap

type TraverseResultMap struct {
	M map[*TreeElem]interface{}
}

type TreeAble

type TreeAble interface {
	Iter() []TreeAble
	PathString() string
}

type TreeElem

type TreeElem struct {
	Data  interface{} // dir no data
	Next  []*TreeElem
	Leaf  bool
	Path  string
	Name  string
	Level int
	// contains filtered or unexported fields
}

func DirTree

func DirTree(p string, opts ...WithOption) *TreeElem

func NewElement

func NewElement(data interface{}) *TreeElem

func NewRooElem

func NewRooElem() *TreeElem

func PlantPathTree

func PlantPathTree(data []interface{}, key string) *TreeElem

func (*TreeElem) GetMindMapData

func (t *TreeElem) GetMindMapData() *vision.MindMapItem

func (*TreeElem) IsRoot

func (t *TreeElem) IsRoot() bool

func (*TreeElem) Iter

func (t *TreeElem) Iter() []TreeAble

func (*TreeElem) PathString

func (t *TreeElem) PathString() string

func (*TreeElem) TraverseAndHandleResult

func (t *TreeElem) TraverseAndHandleResult(tf func(data interface{}) interface{},
	hf func(data ...interface{}) interface{},
	opts ...TreeOption) *TraverseResultMap

type TreeOption

type TreeOption func(o *Option)

func WithTraverseCache

func WithTraverseCache() TreeOption

type WithOption

type WithOption func(o *Option)

Jump to

Keyboard shortcuts

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