app

package
v0.0.0-...-203b069 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppModuleRegister

func AppModuleRegister(name string, module IAppModule, depends []string)

func GetModules

func GetModules() map[string]*AppModule

func GetReadyModules

func GetReadyModules() []string

func GetServeNames

func GetServeNames() []string

func GetServeNamesByModule

func GetServeNamesByModule(module string) []string

func GetServes

func GetServes() map[string]AppServe

func InitializeCmds

func InitializeCmds(cmd string, parent *cobra.Command, opts ...AppCmdOption) error

func InitializeModules

func InitializeModules(appConfig interface{}, opts ...AppModuleOption) error

func RegisterCmd

func RegisterCmd(name string, cmd *cobra.Command, modules []string)

func RegisterServe

func RegisterServe(name string, module string, serve IAppServe) error

func StartServe

func StartServe(ctx context.Context, module string, serve string) error

func StartServes

func StartServes(ctx context.Context, serves []string) error

func StopServes

func StopServes() error

Types

type AppCmd

type AppCmd struct {
	Name    string
	Modules []string
	Cmd     *cobra.Command
}

type AppCmdOption

type AppCmdOption func(*AppCmdOptions)

type AppCmdOptions

type AppCmdOptions struct {
}

type AppModule

type AppModule struct {
	Name    string
	Module  IAppModule
	Depends []string
	Ready   bool
}

func GetModule

func GetModule(name string) (AppModule, bool)

type AppModuleOption

type AppModuleOption func(*AppModuleOptions)

func WithModules

func WithModules(modules []string) AppModuleOption

type AppModuleOptions

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

type AppServe

type AppServe struct {
	Name   string
	Module string
	Serve  IAppServe
}

func GetServe

func GetServe(name string) (AppServe, bool)

type IAppModule

type IAppModule interface {
	Init(appConfig interface{}, depends []string) error
}

type IAppServe

type IAppServe interface {
	Done() <-chan struct{}
	Start(context.Context) error
	Ready() bool
	Stop() error
}

Jump to

Keyboard shortcuts

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