dot

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ctor

type Ctor struct {
	Name        string
	Package     string
	File        string
	Line        int
	ID          CtorID
	Params      []*Param
	GroupParams []*Group
	Results     []*Result
	ErrorType   ErrorType
}

Ctor encodes a constructor provided to the container for the DOT graph.

type CtorID

type CtorID uintptr

CtorID is a unique numeric identifier for constructors.

type ErrorType

type ErrorType int

ErrorType of a constructor or group is updated when they fail to build.

func (ErrorType) Color

func (s ErrorType) Color() string

Color returns the color representation of each ErrorType.

type FailedNodes

type FailedNodes struct {
	// RootCauses is a list of the point of failures. They are the root causes
	// of failed invokes and can be either missing types (not provided) or
	// error types (error providing).
	RootCauses []*Result

	// TransitiveFailures is the list of nodes that failed to build due to
	// missing/failed dependencies.
	TransitiveFailures []*Result
	// contains filtered or unexported fields
}

FailedNodes is the nodes that failed in the graph.

type Graph

type Graph struct {
	Ctors []*Ctor

	Groups []*Group

	Failed *FailedNodes
	// contains filtered or unexported fields
}

Graph is the DOT-format graph in a Container.

func NewGraph

func NewGraph() *Graph

NewGraph creates an empty graph.

func (*Graph) AddCtor

func (dg *Graph) AddCtor(c *Ctor, paramList []*Param, resultList []*Result)

AddCtor adds the constructor with paramList and resultList into the graph.

func (*Graph) AddMissingNodes

func (dg *Graph) AddMissingNodes(results []*Result)

AddMissingNodes adds missing nodes to the list of failed Results in the graph.

func (*Graph) FailGroupNodes

func (dg *Graph) FailGroupNodes(name string, t reflect.Type, id CtorID)

FailGroupNodes finds and adds the failed grouped nodes to the list of failed Results in the graph, and updates the state of the group and constructor with the given id accordingly.

func (*Graph) FailNodes

func (dg *Graph) FailNodes(results []*Result, id CtorID)

FailNodes adds results to the list of failed Results in the graph, and updates the state of the constructor with the given id accordingly.

func (*Graph) PruneSuccess

func (dg *Graph) PruneSuccess()

PruneSuccess removes elements from the graph that do not have failed results. Removing elements that do not have failing results makes the graph easier to debug, since non-failing nodes and edges can clutter the graph and don't help the user debug.

type Group

type Group struct {
	// Type is the type of values in the group.
	Type      reflect.Type
	Name      string
	Results   []*Result
	ErrorType ErrorType
}

Group is a group node in the graph. Group represents an fx value group.

func NewGroup

func NewGroup(k nodeKey) *Group

NewGroup creates a new group with information in the groupKey.

func (*Group) Attributes

func (g *Group) Attributes() string

Attributes composes and returns a string of the Group node's attributes.

func (*Group) String

func (g *Group) String() string

String implements fmt.Stringer for Group.

type Node

type Node struct {
	Type  reflect.Type
	Name  string
	Group string
}

Node is a single node in a graph and is embedded into Params and Results.

type Param

type Param struct {
	*Node

	Optional bool
}

Param is a parameter node in the graph. Parameters are the input to constructors.

func (*Param) String

func (p *Param) String() string

String implements fmt.Stringer for Param.

type Result

type Result struct {
	*Node

	// GroupIndex is added to differentiate grouped values from one another.
	// Since grouped values have the same type and group, their Node / string
	// representations are the same so we need indices to uniquely identify
	// the values.
	GroupIndex int
}

Result is a result node in the graph. Results are the output of constructors.

func (*Result) Attributes

func (r *Result) Attributes() string

Attributes composes and returns a string of the Result node's attributes.

func (*Result) String

func (r *Result) String() string

String implements fmt.Stringer for Result.

Jump to

Keyboard shortcuts

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