hierarchy

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder builds resource hierarchies from the DotEnv API

func NewBuilder

func NewBuilder(client *dotenv.Client) *Builder

NewBuilder creates a new hierarchy builder

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, orgSlug string) (*Node, error)

Build constructs the full hierarchy for an organization

func (*Builder) BuildProject

func (b *Builder) BuildProject(ctx context.Context, projectSlug string) (*Node, error)

BuildProject builds hierarchy for a specific project

func (*Builder) BuildTarget

func (b *Builder) BuildTarget(ctx context.Context, projectSlug, targetSlug string) (*Node, error)

BuildTarget builds hierarchy for a specific target

func (*Builder) ClearCache

func (b *Builder) ClearCache()

ClearCache clears the internal cache

func (*Builder) LoadChildren

func (b *Builder) LoadChildren(ctx context.Context, node *Node) error

LoadChildren loads children for a given node

type Node

type Node struct {
	Type     NodeType
	Name     string
	Slug     string
	Path     string
	Children []*Node
	Metadata interface{} // Can hold *dotenv.Project, *dotenv.Target, or *dotenv.Environment
}

Node represents a node in the resource hierarchy

func (*Node) CountDescendants

func (n *Node) CountDescendants() int

CountDescendants returns the total number of descendants

func (*Node) Find

func (n *Node) Find(path string) *Node

Find searches for a node by path

func (*Node) GetLeaves

func (n *Node) GetLeaves() []*Node

GetLeaves returns all leaf nodes (nodes without children)

func (*Node) SortChildren

func (n *Node) SortChildren()

SortChildren sorts children alphabetically by name

func (*Node) Walk

func (n *Node) Walk(visitor func(*Node) error) error

Walk traverses the hierarchy tree, calling the visitor function for each node

type NodeType

type NodeType string

NodeType represents the type of node in the hierarchy

const (
	NodeTypeOrganization NodeType = "organization"
	NodeTypeProject      NodeType = "project"
	NodeTypeTarget       NodeType = "target"
	NodeTypeEnvironment  NodeType = "environment"
)

Jump to

Keyboard shortcuts

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