dixrender

package
v2.0.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateObjectGraph

func GenerateObjectGraph(dix DixAccessor) string

GenerateObjectGraph generates a graph showing object instances

func GenerateProviderGraph

func GenerateProviderGraph(dix DixAccessor, opts *GraphOptions) string

GenerateProviderGraph generates a graph showing provider functions

func GenerateProviderGraphTypes

func GenerateProviderGraphTypes(dix DixAccessor, opts *GraphOptions) string

GenerateProviderGraphTypes generates a graph showing type dependencies

Types

type DixAccessor

type DixAccessor interface {
	GetProviders() map[reflect.Type][]ProviderFnAccessor
	GetObjects() map[reflect.Type]map[string][]reflect.Value
	GetProviderInputTypes(p ProviderFnAccessor) []reflect.Type
	GetProvideAllInputTypes(typ reflect.Type) []reflect.Type
	GetFnName(fn reflect.Value) string
	GetProviderFn(p ProviderFnAccessor) reflect.Value
}

DixAccessor provides access to Dix container data for rendering This interface allows dixrender to work without importing dixinternal

func NewDixAdapter

func NewDixAdapter(dix *dixinternal.Dix) DixAccessor

NewDixAdapter creates a new adapter for dixinternal.Dix

type DotRenderer

type DotRenderer struct {
	Buf *bytes.Buffer // Exported for testing
	// contains filtered or unexported fields
}

DotRenderer implements DOT format graph rendering

func NewDotRenderer

func NewDotRenderer() *DotRenderer

func (*DotRenderer) BeginSubgraph

func (d *DotRenderer) BeginSubgraph(name, label string)

func (*DotRenderer) EndSubgraph

func (d *DotRenderer) EndSubgraph()

func (*DotRenderer) FormatAttrs

func (d *DotRenderer) FormatAttrs(attrs map[string]string) string

FormatAttrs formats attributes map into DOT format string

func (*DotRenderer) RenderEdge

func (d *DotRenderer) RenderEdge(from, to string, attrs map[string]string)

func (*DotRenderer) RenderNode

func (d *DotRenderer) RenderNode(name string, attrs map[string]string)

func (*DotRenderer) String

func (d *DotRenderer) String() string

func (*DotRenderer) Writef

func (d *DotRenderer) Writef(format string, args ...any)

Writef writes a formatted string to the renderer buffer

type Graph

type Graph struct {
	Objects       string `json:"objects"`
	Providers     string `json:"providers"`
	ProviderTypes string `json:"provider_types"`
}

Graph represents dependency graphs in DOT format

func GenerateGraph

func GenerateGraph(dix DixAccessor) *Graph

GenerateGraph generates a complete dependency graph with default options

func GenerateGraphWithOptions

func GenerateGraphWithOptions(dix DixAccessor, opts *GraphOptions) *Graph

GenerateGraphWithOptions generates a complete dependency graph with custom options

type GraphOptions

type GraphOptions struct {
	// MaxDepth limits the depth of dependencies to show (0 = unlimited)
	MaxDepth int

	// GroupByPackage enables grouping nodes by package
	GroupByPackage bool

	// ShowStructFields controls whether to show struct field dependencies
	ShowStructFields bool

	// FilterPackages allows filtering by specific packages
	FilterPackages []string
}

GraphOptions holds configuration options for graph rendering

func NewGraphOptions

func NewGraphOptions() *GraphOptions

NewGraphOptions creates GraphOptions with sensible defaults

func (*GraphOptions) ShouldIncludeType

func (opts *GraphOptions) ShouldIncludeType(typ string) bool

ShouldIncludeType checks if a type should be included in the graph based on filters

type ProviderFnAccessor

type ProviderFnAccessor interface {
	GetFn() reflect.Value
	GetInputTypes() []reflect.Type
}

ProviderFnAccessor provides access to provider function information

Jump to

Keyboard shortcuts

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