di

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFilename = func(name string) string {
		if idx := strings.LastIndex(name, "/"); idx != -1 {
			name = name[idx+1:]
		}

		return strings.ToLower(name) + ".local"
	}
	ConfigSearchPath = func(kind string) string { return fmt.Sprintf("./config/%s", kind) }
)

Functions

func GetService

func GetService(kind, name string) func(opt ...fx.Option) fx.Option

func GetServiceByKind

func GetServiceByKind(kind string) map[string]ServiceOption

func ProvideDBParams

func ProvideDBParams[Settings any](migrationFS fs.FS) fx.Option

func ProvideRedisParams

func ProvideRedisParams[Settings any]() fx.Option

func RegisterMiddleware

func RegisterMiddleware(mw ...kit.HandlerFunc)

func RegisterService

func RegisterService[S any, SPtr ServicePtr[S]](
	params RegisterServiceParams,
)

func StubProvider

func StubProvider[Settings, IStub, Stub any](
	moduleName, hostPortField string,
	constructor func(hostPort string, opt ...stub.Option) Stub,
) fx.Option

Types

type RegisterServiceParams added in v0.0.2

type RegisterServiceParams struct {
	Kind        string
	Name        string
	InitFn      func(filename string, configPaths ...string)
	ModuleFn    func(opt ...fx.Option) fx.Option
	Middlewares []kit.HandlerFunc
}

type ServiceOption

type ServiceOption = func(opt ...fx.Option) fx.Option

func AllServices

func AllServices() []ServiceOption

type ServicePtr

type ServicePtr[S any] interface {
	*S
	Desc() rony.SetupOption[rony.EMPTY, rony.NOP]
}

Jump to

Keyboard shortcuts

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