Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dependencies ¶ added in v1.1.1
func Dependencies() []string
Dependencies returns the list of registered dependencies.
func Get ¶
func Get[T any]() (module T)
Get returns the registered dependency associated with the given interface.
func GetAfterRegister ¶
func GetAfterRegister[T any](fn func(module T))
GetAfterRegister is a special case for the init function, the callback is triggered after the dependency is registered. If the dependency has already been registered for the given interface, the callback is executed with the registered dependency as a parameter. If the dependency has not yet been registered, the callback is added to the list of registered callbacks for this interface.
func Register ¶
func Register[T any](module T)
Register a dependency associated with the given interface. If a dependency is already registered for this interface, the function does nothing. If callbacks have been registered for this interface, they are executed with the registered dependency as a parameter.
func Reset ¶
func Reset()
Reset resets all registered dependencies by creating new empty maps for the dependencies and callbacks.
func UnRegister ¶ added in v1.1.1
func UnRegister[T any]()
UnRegister removes the dependency associated with the given interface. If no dependency is registered for this interface, the function does nothing.
Types ¶
This section is empty.