package
Version:
v0.0.0-...-3a73874
Opens a new window with list of versions in this module.
Published: Feb 25, 2025
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
func BuildTree(input []interface{}) ([]interface{}, error)
func BuildTreeWithRoot(data []interface{}, rootNode interface{}, mode int) ([]interface{}, error)
data 必须为指针数组
rootNode 必须为指针
mode:
1 : 自动增加根节点, 并且是一棵树. 即跟节点之外的节点都是跟节点的孩子
2 : 自动增加根节点, 但是多棵树, 跟节点下没有孩子,默认跟第一级同级
type BasicTree struct {
ID uint `json:"id"`
ParentID uint `json:"parentId"`
Name string `json:"name"`
Children []*BasicTree `json:"children"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.