Documentation
¶
Index ¶
- Variables
- func CreateInvoker(c *Container, fn any) func() error
- func CreateLister[I any](c *Container) func() []DependencyTarget
- func DynamicInvoke(c *Container, fn any) error
- func Get[I any](c *Container) (I, bool)
- func MustGet[I any](c *Container) I
- func Register(c *Container, v any)
- func RegisterFn(c *Container, fns ...any) error
- func RegisterFor[I any](c *Container, v I)
- func Seal(c *Container)
- type Container
- func (c *Container) CreateInvoker(fn any) func() error
- func (c *Container) CreateLister(t reflect.Type) func() []DependencyTarget
- func (c *Container) DynamicInvoke(fn any) error
- func (c *Container) DynamicList(t reflect.Type) []DependencyTarget
- func (c *Container) MustResolve(t reflect.Type) DependencyTarget
- func (c *Container) Resolve(t reflect.Type) (DependencyTarget, bool)
- func (c *Container) Seal()
- func (c *Container) SetValue(value any)
- func (c *Container) SetValueFor(interfaceType reflect.Type, value any)
- func (c *Container) SetValuesFromFunc(fns ...any) error
- type DependencyTarget
- type Implements
- type Provider
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = NewContainer() //nolint:gochecknoglobals
Functions ¶
func CreateInvoker ¶
func CreateLister ¶
func CreateLister[I any](c *Container) func() []DependencyTarget
func DynamicInvoke ¶
func RegisterFn ¶
func RegisterFor ¶
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container defines the methods for dependency injection container.
func NewContainer ¶
func NewContainer() *Container
NewContainer creates a new dependency injection container.
func (*Container) CreateInvoker ¶
func (*Container) CreateLister ¶
func (c *Container) CreateLister(t reflect.Type) func() []DependencyTarget
func (*Container) DynamicInvoke ¶
func (*Container) DynamicList ¶
func (c *Container) DynamicList(t reflect.Type) []DependencyTarget
func (*Container) MustResolve ¶
func (c *Container) MustResolve(t reflect.Type) DependencyTarget
func (*Container) SetValueFor ¶
func (*Container) SetValuesFromFunc ¶
type DependencyTarget ¶
func DynamicList ¶
func DynamicList[I any](c *Container) []DependencyTarget
type Implements ¶
type Implements[I any] struct{}
Implements is a marker type to associate implementations with interfaces.
Click to show internal directories.
Click to hide internal directories.