BootStarter

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

boot-starter

通用的 Go 程序启动器框架。

type MyApp struct {
}

func (app *MyApp) Start() {
	fmt.Println("app start")
}

func (app *MyApp) ShutDown() {
	fmt.Println("app shutdown")
}

func TestBootStarter(t *testing.T) {

	go func() {
		defer fmt.Println("go stop")
		fmt.Println("go start")

		time.Sleep(200 * time.Millisecond)
		BootStarter.Exit()
	}()

	BootStarter.Run(new(MyApp))
}

Documentation

Overview

实现了一个通用的 Go 程序启动器框架。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

func Exit()

退出当前的应用程序。

func Run

func Run(runner AppRunner)

启动应用执行器。

Types

type AppRunner

type AppRunner interface {
	Start()    // 启动执行器
	ShutDown() // 关闭执行器
}

应用执行器。

Jump to

Keyboard shortcuts

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