Documentation
¶
Overview ¶
Package module defines the core types for modkit's module system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidModuleDef = errors.New("invalid module definition")
ErrInvalidModuleDef indicates a module definition is invalid.
Functions ¶
Types ¶
type ControllerDef ¶
ControllerDef describes how to build a controller instance.
type Module ¶
type Module interface {
Definition() ModuleDef
}
Module provides its definition for graph construction.
type ModuleDef ¶
type ModuleDef struct {
Name string
Imports []Module
Providers []ProviderDef
Controllers []ControllerDef
Exports []Token
}
ModuleDef declares metadata for a module, including its dependencies, providers, controllers, and exported tokens. The name should be unique within the module graph.
type ProviderDef ¶
type ProviderDef struct {
Token Token
Build func(r Resolver) (any, error)
Cleanup func(ctx context.Context) error
}
ProviderDef describes how to build a provider for a token.
Click to show internal directories.
Click to hide internal directories.