leveltree

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LevelNode

type LevelNode[E comparable] interface {
	GetId() E
	GetPId() E
}

LevelNode 层级树泛型约束

type LevelTree

type LevelTree[T LevelNode[E], E comparable] struct {
	Data     T                  `json:"data"`
	Children []*LevelTree[T, E] `json:"children"`
}

LevelTree 菜单和组织单位等分类层级树

func New

func New[T LevelNode[E], E comparable](data []T, rootId E) []*LevelTree[T, E]

New 构建菜单和组织单位等分类层级树

[data] 一组带有pid的数据
[rootId] 树的起始ID

Jump to

Keyboard shortcuts

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