mod

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

README

mod

Small module system build on go.uber.org/dig

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAll

func CloseAll(ctx context.Context, closers ...*CloseHook) []error

func GetFunctionName

func GetFunctionName(function any) string

func Run

func Run(routine any, modules ...ModuleProvider) (runtimeErr error, closeErrs []error)

Types

type CloseHook

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

type Closer

type Closer struct {
	dig.Out

	Hook *CloseHook `group:"closers"`
}

func NilCloser

func NilCloser() Closer

func OnClose

func OnClose(order int, name string, close func(context.Context) error) Closer

type Closers

type Closers struct {
	dig.In

	Closers []*CloseHook `group:"closers"`
}

type InitHook

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

type Initializer

type Initializer struct {
	dig.Out

	Hook *InitHook `group:"initializers"`
}

func NilInit

func NilInit() Initializer

func OnInit

func OnInit(order int, name string, init func(context.Context) error) Initializer

type Initializers

type Initializers struct {
	dig.In

	Initializers []*InitHook `group:"initializers"`
}

type Module

type Module interface {
	Sub(provider ModuleProvider)
	Public(service any)
	Private(service any)
	Run(runtime any) (runtimeErr error, closeErrs []error)
	Init([]*InitHook) []error
	Finalize([]*CloseHook) []error
	// contains filtered or unexported methods
}

func LoadModules

func LoadModules(submodules ...ModuleProvider) Module

type ModuleProvider

type ModuleProvider func(Module)

Jump to

Keyboard shortcuts

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