Documentation
¶
Index ¶
- func ParseOptions(opts ...Option) (fx.Option, error)
- func WithLifecycle(ctx context.Context, lc fx.Lifecycle) context.Context
- type Option
- func Invoke(vals ...interface{}) Option
- func InvokeIf(cond bool, function interface{}) Option
- func Options(opts ...Option) Option
- func OverrideSupply(vals ...interface{}) Option
- func Provide(vals ...interface{}) Option
- func ProvideAs(val interface{}, as ...interface{}) Option
- func ProvideIf(cond bool, ctor ...interface{}) Option
- func Supply(vals ...interface{}) Option
- func SupplyAs(val interface{}, as interface{}) Option
- func SupplyIf(cond bool, val ...interface{}) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseOptions ¶ added in v0.2.0
ParseOptions parses multiple given instances of Option and coverts them into a fx.Option.
Types ¶
type Option ¶ added in v0.2.0
type Option func(*fxOptions) error
Option mimics fx.Option but provides one more OverrideSupply feature.
func OverrideSupply ¶ added in v0.2.0
func OverrideSupply(vals ...interface{}) Option
OverrideSupply overwrites values passed to Provide and Supply. It mimics fx.Supply with one difference - it does not error if there are multiple instances of a type are supplied/provided. Instead, OverrideSupply forces the supply and overrides other Supply and Provide.
Only one overriding must exist for a type.
Only recvs ptr to a value or an interface. To override an interface a ptr to the interface should be provided:
var r io.Reader OverrideSupply(&r)
and not:
var r io.Reader OverrideSupply(r)
Otherwise, real value of r will be provided, e.g. *bytes.Buffer.
func Provide ¶ added in v0.2.0
func Provide(vals ...interface{}) Option
Provide mimics fx.Provide. Provided ctors can be overridden by OverrideSupply.
func ProvideAs ¶
func ProvideAs(val interface{}, as ...interface{}) Option
ProvideAs mimics fx.Provide(fx.Annotate(fx.As())).