module

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerConstructor

type ControllerConstructor struct {
	Fn any
}

ControllerConstructor holds a controller constructor.

type DynamicModule

type DynamicModule struct {
	Factory func(...any) Module
	Options []any
}

DynamicModule wraps a module factory with options.

type MiddlewareConstructor

type MiddlewareConstructor struct {
	Fn any
}

MiddlewareConstructor holds a middleware constructor.

type Module

type Module struct {
	Name        string
	Providers   []any // Provider
	Controllers []ControllerConstructor
	Imports     []Module
	Middlewares []MiddlewareConstructor
	OnInit      []func() error
	OnDestroy   []func() error
	Dynamic     *DynamicModule
}

Module represents a self-contained unit of functionality.

func New

func New(name string, opts ...ModuleOption) Module

New creates a new module with the given name and options.

type ModuleOption

type ModuleOption func(*Module)

ModuleOption configures a Module.

func Controllers

func Controllers(constructors ...any) ModuleOption

Controllers adds controller constructors that receive dependencies via DI.

func Dynamic

func Dynamic(factory func(...any) Module, opts ...any) ModuleOption

Dynamic creates a module option for dynamic modules. The factory function receives the options and returns a configured module. Usage: ligo.Dynamic(NewConfigModule, folder)

func Imports

func Imports(modules ...Module) ModuleOption

Imports adds child modules.

func Middlewares

func Middlewares(constructors ...any) ModuleOption

Middlewares adds middleware constructors that receive dependencies via DI.

func OnModuleDestroy

func OnModuleDestroy(fn func() error) ModuleOption

OnModuleDestroy adds a hook to run when the module is destroyed.

func OnModuleInit

func OnModuleInit(fn func() error) ModuleOption

OnModuleInit adds a hook to run when the module is initialized.

func Providers

func Providers(providers ...any) ModuleOption

Providers adds providers to the module.

Jump to

Keyboard shortcuts

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