Documentation
¶
Index ¶
- Constants
- func GetFnName(fn reflect.Value) string
- func GetProvideAllInputTypes(typ reflect.Type) []reflect.Type
- func SetLog(handler slog.Handler)
- type Dix
- func (dix *Dix) GetObjects() map[reflect.Type]map[string][]reflect.Value
- func (dix *Dix) GetProviderDetails() []ProviderDetails
- func (dix *Dix) GetProviders() map[reflect.Type][]*providerFn
- func (dix *Dix) Inject(param any, opts ...Option) any
- func (dix *Dix) Option() Options
- func (dix *Dix) Provide(param any)
- func (dix *Dix) TryInject(param any, opts ...Option) error
- func (dix *Dix) TryProvide(param any) (err error)
- type Option
- type Options
- type ProviderDetails
Constants ¶
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 GetProvideAllInputTypes ¶
GetProvideAllInputTypes returns all input types for a given type, including struct fields This is a public version of getProvideAllInputs that returns types instead of internal structures
Types ¶
type Dix ¶
type Dix struct {
// contains filtered or unexported fields
}
func (*Dix) GetObjects ¶
GetObjects returns a copy of the objects map for inspection This is useful for HTTP visualization endpoints
func (*Dix) GetProviderDetails ¶
func (dix *Dix) GetProviderDetails() []ProviderDetails
GetProviderDetails returns detailed information about all providers
func (*Dix) GetProviders ¶
GetProviders returns a copy of the providers map for inspection This is useful for HTTP visualization endpoints
func (*Dix) Inject ¶
Inject injects dependencies into the given parameter. Panics on error. NOTE: Dix container is not thread-safe. Do not call Provide/Inject concurrently on the same container.
func (*Dix) Provide ¶
Provide registers a provider function. Panics on error. NOTE: Dix container is not thread-safe. Do not call Provide/Inject concurrently on the same container.
func (*Dix) TryInject ¶
TryInject injects dependencies into the given parameter. Returns error instead of panicking. NOTE: Dix container is not thread-safe. Do not call Provide/Inject concurrently on the same container.
func (*Dix) TryProvide ¶
TryProvide registers a provider function. Returns error instead of panicking. NOTE: Dix container is not thread-safe. Do not call Provide/Inject concurrently on the same container.