Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // EHealthCheckTimeout todo EHealthCheckTimeout = errors.PersistentCode(errors.DDependency, errors.ATimeout) )
Functions ¶
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶
func (*Container) UnsafeExecute ¶ added in v0.1.3
type Dependency ¶
type Dependency struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func NewFactory(value any) (*Dependency, error)
func NewInstance ¶
func NewInstance(kind reflect.Type) (*Dependency, error)
func NewSideEffect ¶
func NewSideEffect(value any) (*Dependency, error)
func (*Dependency) HasIO ¶
func (d *Dependency) HasIO() bool
func (*Dependency) ID ¶
func (d *Dependency) ID() xid.ID
func (*Dependency) Kind ¶
func (d *Dependency) Kind() Kind
func (*Dependency) Name ¶
func (d *Dependency) Name() string
func (*Dependency) Solve ¶
func (d *Dependency) Solve(value any, err error)
func (*Dependency) Status ¶
func (d *Dependency) Status() Status
func (*Dependency) Value ¶
func (d *Dependency) Value() (any, error)
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
type GraphBuilder ¶
type GraphBuilder struct {
// contains filtered or unexported fields
}
func NewGraphBuilder ¶
func NewGraphBuilder() *GraphBuilder
type InstanceContainer ¶
func (*InstanceContainer) String ¶
func (i *InstanceContainer) String() string
type Kind ¶
type Kind int
const ( //Factory represent a dependency which can instantiate new dependencies. //This is the entrypoint to the whole DI system and the solver will try to associate every declare Instance with //their own Factory. //Do not declare a Factory which uses scalar types like `int32` or `[]string{}`, always use opaque types or rethink //your implementation. //Factory should be implemented with a pure function, with no side-effects. If you need to mutate external state //use SideEffect instead. //Factory should only be used to declare heavy-lifter objects (services, drivers, resources) which have complex //lifecycles, or depends on each other. Factory Kind = iota //SideEffect is a dependency which should be invoked whenever the DI system has finished bootstrapping. SideEffect //Instance represent the actual value of the dependency, used and created by both factories and transitives Instance )
type ModuleOption ¶
type ModuleOption func(module *Module)
func Factories ¶
func Factories(exports ...any) ModuleOption
func SideEffects ¶
func SideEffects(invocation ...any) ModuleOption
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) FindByName ¶
func (r *Registry) FindByName(name string) (*Dependency, bool)
func (*Registry) Kind ¶
func (r *Registry) Kind(kinds ...Kind) []*Dependency
func (*Registry) Register ¶
func (r *Registry) Register(dependency *Dependency) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.