Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToProvider ¶
ToProvider converts a Factory function into a do.Provider. The returned provider can be used in a dependency injection container to resolve and invoke the factory function, creating instances of type T.
Example:
factory := func() *Type { return &Type{} }
provider := dofactory.ToProvider(factory)
injector := do.New()
do.Provide(injector, provider)
typeInstance := do.MustInvoke[*Type](injector)
Parameters:
- factory: The factory function that creates instances of type T.
Returns:
- A do.Provider that invokes the factory function to create instances of T.
Types ¶
Click to show internal directories.
Click to hide internal directories.