Documentation
¶
Overview ¶
Package di is a wrapper of fx, which allows to use DI across the whole lifecycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Extract ¶
func Extract(target interface{})
Extract an injected object to a variable.
For example, we can extrat injected `Some` object to a global variable:
type globals struct { some *Some } var g = &globals{}; func init() { di.Extract(&g); }
func Invoke ¶
func Invoke(fn interface{})
Invoke a function with injected objects as parameters.
For example, we want use `Some` object:
func init() { di.Invoke(func(s *Some) { // -- snip -- }) }
func InvokeBefore ¶
func InvokeBefore(fn interface{})
InvokeBefore invoke the given function before others.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.