dep_tree

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectorDestinationNodeIdTag = "connectorDestination"
View Source
const ConnectorOriginNodeIdTag = "connectorOrigin"
View Source
const NodeIdTag = "nodeId"
View Source
const NodeIndexTag = "nodeIndex"
View Source
const NodeParentsTag = "nodeParents"

Variables

This section is empty.

Functions

func LoadDeps

func LoadDeps[T any](
	ctx context.Context,
	g *graph.Graph[T],
	parser NodeParser[T],
) (context.Context, string, error)

func PrintStructured

func PrintStructured[T any](
	ctx context.Context,
	entrypoint string,
	parserBuilder func(string) (NodeParser[T], error),
) (string, error)

Types

type DepCycle

type DepCycle struct {
	Cause [2]string
	Stack []string
}

type DepTree

type DepTree[T any] struct {
	Nodes  []*DepTreeNode[T]
	Graph  *graph.Graph[T]
	RootId string
	Cycles *orderedmap.OrderedMap[[2]string, DepCycle]
}

func NewDepTree

func NewDepTree[T any](
	ctx context.Context,
	parser NodeParser[T],
) (context.Context, *DepTree[T], error)

func (*DepTree[T]) Render

func (dt *DepTree[T]) Render(display func(node *graph.Node[T]) string) (*board.Board, error)

func (*DepTree[T]) RenderStructured

func (dt *DepTree[T]) RenderStructured(display func(node *graph.Node[T]) string) ([]byte, error)

type DepTreeNode

type DepTreeNode[T any] struct {
	Node *graph.Node[T]
	Lvl  int
}

func GetDepTreeNodes

func GetDepTreeNodes[T any](
	ctx context.Context,
	g *graph.Graph[T],
	rootId string,
) (context.Context, []*DepTreeNode[T], *orderedmap.OrderedMap[[2]string, DepCycle])

type LevelCalculator

type LevelCalculator[T any] struct {
	Cycles *orderedmap.OrderedMap[[2]string, DepCycle]
	// contains filtered or unexported fields
}

func NewLevelCalculator

func NewLevelCalculator[T any](
	g *graph.Graph[T],
	rootId string,
) *LevelCalculator[T]

type NodeParser

type NodeParser[T any] interface {
	Display(node *graph.Node[T]) string
	Entrypoint() (*graph.Node[T], error)
	Deps(ctx context.Context, node *graph.Node[T]) (context.Context, []*graph.Node[T], error)
}

type StructuredTree

type StructuredTree struct {
	Tree                 map[string]interface{} `json:"tree" yaml:"tree"`
	CircularDependencies [][]string             `json:"circularDependencies" yaml:"circularDependencies"`
	Errors               map[string][]string    `json:"errors" yaml:"errors"`
}

type TestParser

type TestParser struct {
	Start string
	Spec  [][]int
}

func (*TestParser) Deps

func (t *TestParser) Deps(ctx context.Context, n *graph.Node[[]int]) (context.Context, []*graph.Node[[]int], error)

func (*TestParser) Display

func (t *TestParser) Display(n *graph.Node[[]int]) string

func (*TestParser) Entrypoint

func (t *TestParser) Entrypoint() (*graph.Node[[]int], error)

Jump to

Keyboard shortcuts

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