treebuilder

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build[T any](nodes []T, adapter Adapter[T]) []T

func FindNode

func FindNode[T any](roots []T, targetId string, adapter Adapter[T]) (T, bool)

func FindNodePath

func FindNodePath[T any](roots []T, targetId string, adapter Adapter[T]) ([]T, bool)

Types

type Adapter

type Adapter[T any] struct {
	GetId       func(T) string
	GetParentId func(T) string
	GetChildren func(T) []T
	SetChildren func(*T, []T)
}

Jump to

Keyboard shortcuts

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