lifecycle

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LifecycleManager

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

LifecycleManager 应用生命周期管理器

func NewLifecycleManager

func NewLifecycleManager(_ interface{}) *LifecycleManager

NewLifecycleManager 创建生命周期管理器

func (*LifecycleManager) AddShutdownHook

func (lm *LifecycleManager) AddShutdownHook(hook func() error)

AddShutdownHook 添加关闭钩子

func (*LifecycleManager) AddStartupHook

func (lm *LifecycleManager) AddStartupHook(hook func() error)

AddStartupHook 添加启动钩子

func (*LifecycleManager) GetShutdownContext

func (lm *LifecycleManager) GetShutdownContext() context.Context

GetShutdownContext 获取关闭上下文

func (*LifecycleManager) GracefulShutdown

func (lm *LifecycleManager) GracefulShutdown(timeout time.Duration) error

GracefulShutdown 优雅关闭(简化版本)

func (*LifecycleManager) Run

func (lm *LifecycleManager) Run() error

Run 运行应用(简化版本,只处理钩子和信号)

Jump to

Keyboard shortcuts

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