dixinternal

package
v2.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// InjectMethodPrefix can inject objects, as long as the method of this object contains a prefix of `InjectMethodPrefix`
	InjectMethodPrefix = "DixInject"
)

Variables

This section is empty.

Functions

func GetFnName

func GetFnName(fn reflect.Value) string

GetFnName returns the name of the function represented by reflect.Value

func SetLog

func SetLog(handler slog.Handler)

Types

type Dix

type Dix struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Dix

New Dix new

func (*Dix) Graph

func (dix *Dix) Graph() *Graph

Graph generates dependency graphs with default options

func (*Dix) GraphWithOptions

func (dix *Dix) GraphWithOptions(opts *GraphOptions) *Graph

GraphWithOptions generates dependency graphs with custom options

func (*Dix) Inject

func (dix *Dix) Inject(param any, opts ...Option) any

func (*Dix) Option

func (dix *Dix) Option() Options

func (*Dix) Provide

func (dix *Dix) Provide(param any)

type DotRenderer

type DotRenderer struct {
	// 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) 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

type Graph

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

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

type Option

type Option func(opts *Options)

func WithValuesNull

func WithValuesNull() Option

type Options

type Options struct {
	// AllowValuesNull allows result to be nil
	AllowValuesNull bool
}

func (Options) Merge

func (o Options) Merge(opt Options) Options

func (Options) Validate

func (o Options) Validate() error

Jump to

Keyboard shortcuts

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