BootStarter

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: Apache-2.0 Imports: 5 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()

Exit 关闭执行器

func Run

func Run(runner AppRunner)

Run 启动执行器

Types

type AppRunner

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

AppRunner 应用执行器

Jump to

Keyboard shortcuts

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