Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LifecycleCmd ¶
func LifecycleCmd(fn LifecycleAction) cli.ActionFunc
LifecycleCmd 是一个函数,用于创建一个 cli.ActionFunc。 该函数会调用生命周期管理操作,并在中断信号时优雅地关闭应用。
Types ¶
type CloneableGeneric ¶
type Lifecycle ¶
type Lifecycle interface {
Start(ctx context.Context) error
Stop(ctx context.Context) error
Stopped() bool
}
Lifecycle 接口定义了应用程序的生命周期管理方法。 Start: 启动应用程序。 Stop: 停止应用程序。 Stopped: 检查应用程序是否已经停止。
type LifecycleAction ¶
LifecycleAction 是一个函数类型,用于初始化一个生命周期管理对象。 它接收命令行上下文和取消函数,返回一个实现了 Lifecycle 接口的对象。
Click to show internal directories.
Click to hide internal directories.