appruntime

package
v0.0.0-...-b3af538 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApp

func NewApp(appName string, appOptions AppOptions, rb RunnerBuilder, opts ...Option)

NewApp 创建一个application. TODO: 解析配置文件

Types

type AppOptions

type AppOptions interface {
	AddFlags()
	Validate() []error
}

type Option

type Option func(opt *option)

func AfterStop

func AfterStop(f func()) Option

AfterStop 在调用runner.Stop之后

func BeforeRun

func BeforeRun(f func()) Option

BeforeRun 在调用runner.Run之前执行

func WaitStopSignal

func WaitStopSignal(f func()) Option

WaitStopSignal 等待退出信号

type Runner

type Runner interface {
	// Run 启动服务
	Run(ctx context.Context)
	// Stop 停止服务
	Stop()
}

type RunnerBuilder

type RunnerBuilder func() Runner

Jump to

Keyboard shortcuts

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