fxutil

package
v0.5.0-slava Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InvokeIf

func InvokeIf(cond bool, function interface{}) fx.Option

InvokeIf invokes a given function if a condition is met.

func ProvideAs

func ProvideAs(cnstr interface{}, cnstrs ...interface{}) fx.Option

ProvideAs creates an FX option that provides constructor 'cnstr' with the returned values types as 'cnstrs' It is as simple utility that hides away FX annotation details.

func ProvideIf

func ProvideIf(cond bool, ctor ...interface{}) fx.Option

ProvideIf provides a given constructor if a condition is met.

func ReplaceAs

func ReplaceAs(val interface{}, cnstrs ...interface{}) fx.Option

ReplaceAs creates an FX option that substitutes types defined by constructors 'cnstrs' with the value 'val'. It is as simple utility that hides away FX annotation details.

func SupplyIf

func SupplyIf(cond bool, val ...interface{}) fx.Option

SupplyIf supplies DI if a condition is met.

func WithLifecycle

func WithLifecycle(ctx context.Context, lc fx.Lifecycle) context.Context

WithLifecycle wraps a context to be canceled when the lifecycle stops.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL