expose ModuleFn type
This commit is contained in:
12
module.go
12
module.go
@@ -10,8 +10,8 @@ import (
|
||||
// ErrModuleNotFound is returned when a module is not found in the lifecycle.
|
||||
var ErrModuleNotFound = errors.New("module not found")
|
||||
|
||||
// moduleFn is a function type for module setup and teardown functions.
|
||||
type moduleFn func(*Module) error
|
||||
// ModuleFn is a function type for module setup and teardown functions.
|
||||
type ModuleFn func(*Module) error
|
||||
|
||||
// GenericModule is an interface that allows modules to be extended with custom
|
||||
// functionality, as the module can return a pointer to the underlying Module.
|
||||
@@ -26,8 +26,8 @@ type Module struct {
|
||||
lifecycle *Lifecycle // lifecycle is the parent lifecycle this module belongs to
|
||||
logger *slog.Logger
|
||||
name string
|
||||
setup moduleFn
|
||||
teardown moduleFn
|
||||
setup ModuleFn
|
||||
teardown ModuleFn
|
||||
depends []string
|
||||
loaded bool // loaded indicates if the module has been set up
|
||||
}
|
||||
@@ -35,9 +35,9 @@ type Module struct {
|
||||
// ModuleOpts contains user-exposed options when defining a module.
|
||||
type ModuleOpts struct {
|
||||
// Setup is the setup function for the module.
|
||||
Setup moduleFn
|
||||
Setup ModuleFn
|
||||
// Teardown is the teardown function for the module.
|
||||
Teardown moduleFn
|
||||
Teardown ModuleFn
|
||||
// Depends is a list of modules that this module depends on. Each entry must
|
||||
// be the exact name of a module registered in the lifecycle.
|
||||
Depends []string
|
||||
|
||||
Reference in New Issue
Block a user