dig: go.uber.org/dig/internal/dot Index | Files

package dot

import "go.uber.org/dig/internal/dot"

Index

Package Files

graph.go

type Ctor Uses

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 Uses

type CtorID uintptr

CtorID is a unique numeric identifier for constructors.

type ErrorType Uses

type ErrorType int

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

func (ErrorType) Color Uses

func (s ErrorType) Color() string

Color returns the color representation of each ErrorType.

type FailedNodes Uses

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 Uses

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 Uses

func NewGraph() *Graph

NewGraph creates an empty graph.

func (*Graph) AddCtor Uses

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

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

func (*Graph) AddMissingNodes Uses

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

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

func (*Graph) FailGroupNodes Uses

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 Uses

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 Uses

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 Uses

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 Uses

func NewGroup(k nodeKey) *Group

NewGroup creates a new group with information in the groupKey.

func (*Group) Attributes Uses

func (g *Group) Attributes() string

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

func (*Group) String Uses

func (g *Group) String() string

String implements fmt.Stringer for Group.

type Node Uses

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 Uses

type Param struct {
    *Node

    Optional bool
}

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

func (*Param) String Uses

func (p *Param) String() string

String implements fmt.Stringer for Param.

type Result Uses

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 Uses

func (r *Result) Attributes() string

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

func (*Result) String Uses

func (r *Result) String() string

String implements fmt.Stringer for Result.

Package dot imports 2 packages (graph) and is imported by 1 packages. Updated 2019-01-07. Refresh now. Tools for package owners.