Documentation
¶
Index ¶
- Variables
- type App
- type Boot
- type BootImpl
- func (b *BootImpl) Config() *gs_conf.BootConfig
- func (b *BootImpl) FuncRunner(fn func() error) *gs.RegisteredBean
- func (b *BootImpl) Object(i any) *gs.RegisteredBean
- func (b *BootImpl) Provide(ctor any, args ...gs.Arg) *gs.RegisteredBean
- func (b *BootImpl) Register(bd *gs.BeanDefinition) *gs.RegisteredBean
- func (b *BootImpl) Run() error
- type ReadySignal
Constants ¶
This section is empty.
Variables ¶
var GS = NewApp()
GS is the global application instance.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
C *gs_core.Container
P *gs_conf.AppConfig
Runners []gs.Runner `autowire:"${spring.app.runners:=?}"`
Jobs []gs.Job `autowire:"${spring.app.jobs:=?}"`
Servers []gs.Server `autowire:"${spring.app.servers:=?}"`
EnableJobs bool `value:"${spring.app.enable-jobs:=true}"`
EnableServers bool `value:"${spring.app.enable-servers:=true}"`
// contains filtered or unexported fields
}
App represents the core application, managing its lifecycle, configuration, and dependency injection.
func (*App) Run ¶
Run starts the application and listens for termination signals (e.g., SIGINT, SIGTERM). Upon receiving a signal, it initiates a graceful shutdown.
func (*App) RunWith ¶ added in v1.2.2
RunWith starts the application and listens for termination signals (e.g., SIGINT, SIGTERM). Upon receiving a signal, it initiates a graceful shutdown.
func (*App) ShutDown ¶
func (app *App) ShutDown()
ShutDown gracefully terminates the application. This method should be called to trigger a proper shutdown process.
type Boot ¶
type Boot interface {
// Config returns the boot configuration.
Config() *gs_conf.BootConfig
// Object registers an object bean.
Object(i any) *gs.RegisteredBean
// Provide registers a bean using a constructor function.
Provide(ctor any, args ...gs.Arg) *gs.RegisteredBean
// Register registers a BeanDefinition instance.
Register(bd *gs.BeanDefinition) *gs.RegisteredBean
// FuncRunner creates a Runner from a function.
FuncRunner(fn func() error) *gs.RegisteredBean
}
Boot defines the interface for application bootstrapping.
type BootImpl ¶
type BootImpl struct {
Runners []gs.Runner `autowire:"${spring.boot.runners:=?}"`
// contains filtered or unexported fields
}
BootImpl is the bootstrapper of the application.
func (*BootImpl) Config ¶
func (b *BootImpl) Config() *gs_conf.BootConfig
Config returns the boot configuration.
func (*BootImpl) FuncRunner ¶
func (b *BootImpl) FuncRunner(fn func() error) *gs.RegisteredBean
FuncRunner creates a Runner from a function.
func (*BootImpl) Object ¶
func (b *BootImpl) Object(i any) *gs.RegisteredBean
Object registers an object bean.
func (*BootImpl) Register ¶
func (b *BootImpl) Register(bd *gs.BeanDefinition) *gs.RegisteredBean
Register registers a BeanDefinition instance.
type ReadySignal ¶
type ReadySignal struct {
// contains filtered or unexported fields
}
ReadySignal is used to notify that the application is ready to serve requests.
func NewReadySignal ¶
func NewReadySignal() *ReadySignal
NewReadySignal creates a new ReadySignal instance.
func (*ReadySignal) Close ¶
func (s *ReadySignal) Close()
Close closes the signal channel, notifying all goroutines waiting on it.
func (*ReadySignal) Intercept ¶
func (s *ReadySignal) Intercept()
Intercept marks the signal as intercepted.
func (*ReadySignal) Intercepted ¶
func (s *ReadySignal) Intercepted() bool
Intercepted returns true if the signal has been intercepted.
func (*ReadySignal) TriggerAndWait ¶
func (s *ReadySignal) TriggerAndWait() <-chan struct{}
TriggerAndWait marks an operation as done by decrementing the WaitGroup counter, and then returns the readiness signal channel for waiting.
func (*ReadySignal) Wait ¶
func (s *ReadySignal) Wait()
Wait blocks until all WaitGroup counters reach zero.