package
Version:
v0.19.0
Opens a new window with list of versions in this module.
Published: Jan 27, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
func Build[T any](nodes []T, adapter Adapter[T]) []T
Build constructs a tree structure from a flat slice of nodes using the provided adapter.
FindNode searches for a node with the given ID in the tree and returns it if found.
FindNodePath returns the path from root to the target node if found.
type Adapter[T any] struct {
GetID func(T) string
GetParentID func(T) string
GetChildren func(T) []T
SetChildren func(*T, []T)
}
Adapter provides functions to access tree node properties.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.