fx_opt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConstructorFuncs = []interface{}{
	srv.NewAbc,

	fx.Annotate(
		func() string {
			return "这是Abc2的Content参数"
		},
		fx.ResultTags(`name:"abc2content"`),
	),

	fx.Annotate(
		srv.NewAbc2,
		fx.ParamTags(``, ``, `name:"abc2content"`),
	),

	srv.NewAbc3,
}

添加其他需要在fx中构建的实例的方法

View Source
var InvokeFuncs = []interface{}{
	func(srv.Abc) {},
	func(srv.Abc2) {},
	func(srv.Abc3) {},
}

在ConstructorFuncs添加了方法后,如果需要在方法的参数中传递fx.Lifecycle,已实现fx.Hook。需要在下方添加fx的invoke方法。

Functions

func AddOtherProvide

func AddOtherProvide(constructors ...interface{}) fx.Option

Types

type FxSrv

type FxSrv struct {
	// contains filtered or unexported fields
}

func NewFxSrv

func NewFxSrv(configPath string) FxSrv

func (*FxSrv) Setup

func (f *FxSrv) Setup()

func (*FxSrv) Shutddown

func (f *FxSrv) Shutddown()

func (*FxSrv) Start

func (f *FxSrv) Start()

Directories

Path Synopsis
component

Jump to

Keyboard shortcuts

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