Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct {
Kind ArgumentKind
Value string
Literal Literal
Packages []string
// Source location (optional)
SourceLoc *srcloc.Location
}
Argument represents a constructor argument.
type ArgumentKind ¶
type ArgumentKind int
ArgumentKind is the parsed kind of a constructor argument.
const ( ArgLiteral ArgumentKind = iota ArgServiceRef ArgInner ArgParam ArgTagged ArgSpread ArgGoRef ArgFieldAccessService ArgFieldAccessGo )
type Config ¶
type Config struct {
Parameters map[string]Parameter
Tags map[string]Tag
Services map[string]Service
}
Config is the root configuration for the DI container. This is a resolved configuration with no import directives.
func ApplyInternalPasses ¶
ApplyInternalPasses applies mandatory internal transformation passes. These passes desugar high-level config constructs (like decorators) into simpler primitives before IR building.
func ApplyPasses ¶
ApplyPasses applies compiler passes sequentially to the config. Each pass receives the result of the previous pass.
type Constructor ¶
type Constructor struct {
Func string
Method string
Args []Argument
Packages []string
// Source locations (optional)
SourceLoc *srcloc.Location
}
Constructor defines service constructor configuration.
type DecoratorPass ¶
type DecoratorPass struct{}
DecoratorPass transforms decorator services into plain services and aliases. This is an internal mandatory pass applied during the pipeline build after a user passes.
Transformation example:
Input:
base: { constructor: ... }
dec: { decorates: "base", args: ["@.inner"] }
Output:
dec.inner: { constructor: <original base constructor> }
dec: { args: ["@dec.inner"] }
base: { alias: "dec" }
func (*DecoratorPass) Name ¶
func (p *DecoratorPass) Name() string
type ExposeAllPass ¶
type ExposeAllPass struct{}
ExposeAllPass promotes every service to public, causing the generator to emit a public getter for each one. Intended for test containers that need direct access to all services regardless of how they are declared in the YAML config.
Enable via: --enable-pass=expose-all
Avoid using in production containers — it overrides explicit `public: false` declarations and disables unreachable-service pruning (all services become reachable roots), so every imported service gets a generated getter.
func (*ExposeAllPass) Name ¶
func (p *ExposeAllPass) Name() string
type Literal ¶
type Literal struct {
Kind LiteralKind
Value any // string, int64, float64, bool, or nil
}
Literal represents a typed literal value, independent of any parsing format.
func NewFloatLiteral ¶
NewFloatLiteral creates a float literal.
func NewStringLiteral ¶
NewStringLiteral creates a string literal.
type LiteralKind ¶
type LiteralKind int
LiteralKind indicates the type of a literal value.
const ( LiteralString LiteralKind = iota LiteralInt LiteralFloat LiteralBool LiteralNull )
type Parameter ¶
Parameter defines a parameter default value. Its target type is contextual: it comes from each constructor argument the parameter is injected into, not from the declaration.
type Pass ¶
Pass is a compiler pass that transforms config before validation and generation. Passes mutate the config and return it for chaining.
type Service ¶
type Service struct {
Type string
Constructor Constructor
Public bool
Autoconfigure bool
Decorates string
DecorationPriority int
Tags []ServiceTag
Alias string
Packages []string
// Source location (optional)
SourceLoc *srcloc.Location
}
Service defines a service entry.