depgraph

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidQuery = errors.New("invalid query")

Functions

This section is empty.

Types

type DepGraph

type DepGraph struct {
	Path  string
	Main  *Module
	Graph *graph.HierarchicalDigraph
	// contains filtered or unexported fields
}

DepGraph represents a Go module's dependency graph.

func GetGraph

func GetGraph(dl *logger.Builder, path string) (*DepGraph, error)

GetGraph will return the dependency graph for the Go module that can be found at the specified path.

func NewGraph

func NewGraph(log *logger.Logger, path string, main *modules.ModuleInfo) *DepGraph

func (*DepGraph) AddModule

func (g *DepGraph) AddModule(module *modules.ModuleInfo) *Module

func (*DepGraph) ApplyQuery

func (g *DepGraph) ApplyQuery(dl *logger.Builder, q query.Expr, level Level) error

type Level

type Level uint8
const (
	LevelModules Level = iota
	LevelPackages
)

type Module

type Module struct {
	Info               *modules.ModuleInfo
	Indirects          map[string]bool
	VersionConstraints map[string]VersionConstraint
	// contains filtered or unexported fields
}

Module represents a module in a Go module's dependency graph.

func NewModule

func NewModule(info *modules.ModuleInfo) *Module

func (*Module) Children

func (m *Module) Children() *graph.NodeRefs

func (*Module) EdgeAttributes

func (m *Module) EdgeAttributes(target graph.Node, annotate bool) []string

func (*Module) Hash

func (m *Module) Hash() string

func (*Module) Name

func (m *Module) Name() string

Name of the module represented by this Dependency in the Graph instance.

func (*Module) NodeAttributes

func (m *Module) NodeAttributes(annotate bool) []string

func (*Module) Parent

func (m *Module) Parent() graph.Node

func (*Module) Predecessors

func (m *Module) Predecessors() *graph.NodeRefs

func (*Module) SelectedVersion

func (m *Module) SelectedVersion() string

SelectedVersion corresponds to the version of the dependency represented by this Dependency which was selected for use.

func (*Module) String

func (m *Module) String() string

func (*Module) Successors

func (m *Module) Successors() *graph.NodeRefs

func (*Module) Timestamp

func (m *Module) Timestamp() *time.Time

Timestamp returns the time corresponding to the creation of the version at which this dependency is used.

type Package

type Package struct {
	Info *modules.PackageInfo
	// contains filtered or unexported fields
}

Package represents a single Go package in a dependency graph.

func NewPackage

func NewPackage(info *modules.PackageInfo, parent *Module) *Package

func (*Package) Children

func (p *Package) Children() *graph.NodeRefs

func (*Package) EdgeAttributes added in v0.6.1

func (p *Package) EdgeAttributes(target graph.Node, annotate bool) []string

func (*Package) Hash

func (p *Package) Hash() string

func (*Package) Name

func (p *Package) Name() string

Name returns the import path of the package and not the value declared inside the package with the 'package' statement.

func (*Package) NodeAttributes added in v0.6.1

func (p *Package) NodeAttributes(annotate bool) []string

func (*Package) Parent

func (p *Package) Parent() graph.Node

func (*Package) Predecessors

func (p *Package) Predecessors() *graph.NodeRefs

func (*Package) String

func (p *Package) String() string

func (*Package) Successors

func (p *Package) Successors() *graph.NodeRefs

type VersionConstraint

type VersionConstraint struct {
	Source string
	Target string
}

Jump to

Keyboard shortcuts

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