stopper

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 5 Imported by: 2

README

stopper

用于优雅的停止像 http-server 之类的 daemon 程序

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMainModule

func NewMainModule() *application.ModuleBuilder

NewMainModule ...

func NewTestModule

func NewTestModule() *application.ModuleBuilder

NewTestModule ...

Types

type Action added in v0.0.2

type Action string

Action ... 表示传入的动作指令

const (
	ActionNone    Action = "none"
	ActionStart   Action = "start"
	ActionStop    Action = "stop"
	ActionRestart Action = "restart"
)

定义几个传入的动作指令

func GetAction added in v0.0.3

func GetAction(ac application.Context) Action

GetAction 从上下文中取操作码

func ParseAction added in v0.0.2

func ParseAction(text string) (Action, error)

ParseAction ...

type Scope

type Scope int

Scope 表示 stop 的作用域

const (
	ScopeNone  Scope = 0
	ScopeThis  Scope = 1
	ScopeNewer Scope = 2
	ScopeOlder Scope = 3
	ScopeAll   Scope = 4
)

定义 stop 的作用域

func GetScope added in v0.0.3

func GetScope(ac application.Context) Scope

GetScope 从上下文中取操作作用域

func ParseScope added in v0.0.2

func ParseScope(text string) (Scope, error)

ParseScope ...

type Service

type Service interface {
	Stop(c context.Context, scope Scope) error
}

Service ...

Directories

Path Synopsis
gen
modules
src
configen/golang command
main/golang command
test/golang command

Jump to

Keyboard shortcuts

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