leveltree

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 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
	Children []*LevelTree[T, E]
}

LevelTree 菜单或分类层级树

func New

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

New 构建菜单或分类层级树(data=按pid归类后的数据, pid=树的起始ID)

Jump to

Keyboard shortcuts

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