Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionFunc ¶
type ActionFunc func(GraphObject) error
ActionFunc is a function that is executed for each node in the graph. Returning an error will cause the graph walk to abort.
type GraphObject ¶
type GraphObject interface { Name() string // the unique name for the object String() string // the pretty-printed string for the object. Can be one of the following: // - a string of alphabetic ([a-zA-Z\x80-\xff]) characters, underscores ('_'). // digits ([0-9]), not beginning with a digit. // - a numeral [-]?(.[0-9]+ | [0-9]+(.[0-9]*)?). // - a double-quoted string ("...") possibly containing escaped quotes (\"). // - an HTML string (<...>) Dependencies() []string // names of dependencies, in any order }
GraphObject describes an object that will become a node in the graph
type LogFunc ¶
type LogFunc func(string, ...interface{})
LogFunc is a function that logs a formatted string somewhere
type ObjectGraph ¶
type ObjectGraph struct { LogF LogFunc // contains filtered or unexported fields }
ObjectGraph builds and analyzes a graph of the supplied objects
func (*ObjectGraph) Build ¶
func (og *ObjectGraph) Build(objs []GraphObject) error
Build populates the graph with the supplied objects
func (*ObjectGraph) Dot ¶
func (og *ObjectGraph) Dot(name string) ([]byte, error)
Dot returns the GraphWiz DOT output for the graph
func (*ObjectGraph) Info ¶
func (og *ObjectGraph) Info() (root GraphObject, levels [][]GraphObject, err error)
Info returns the root and levels of the graph
func (*ObjectGraph) Walk ¶
func (og *ObjectGraph) Walk(ctx context.Context, af ActionFunc) error
Walk traverses the graph levels in decending order, executing af for every node in a given level concurrently
Click to show internal directories.
Click to hide internal directories.