core

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddServer

func AddServer(s server.Server)

func AddWorker

func AddWorker(w worker.Worker)

func GracefulStop

func GracefulStop(ctx context.Context) (err error)

GracefulStop application after necessary cleanup

func Init

func Init(baseConfig LoadBaseConfigFunction) (err error)

func RegisterHooks

func RegisterHooks(k Stage, fns ...func() error) error

RegisterHooks register a stage Hook

func Run

func Run()

Run run application

func Stop

func Stop() (err error)

Stop application immediately after necessary cleanup

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

type BaseConfig

type BaseConfig struct {
	// 日志路径,为空终端打印
	LogPath string
	// 配置源:nacos/file
	ConfigSource string
	// 配置路径:
	// file: 文件地址
	// nacos: host+port,无http前缀
	ConfigPath string
	// 是否watch
	EnableWatch bool
	// etcd的目录
	PropertyKey string
	// 用户名
	Username string
	// 密码
	Password string
	// nacos data_id
	DataID string
	// nacos group
	Group string
	// nacos config type
	Suffix string
	// nacos namespaceID
	NamespaceID string
}

type LoadBaseConfigFunction

type LoadBaseConfigFunction func()

func LoadWithFlags

func LoadWithFlags() LoadBaseConfigFunction

func LoadWithInput

func LoadWithInput(b *BaseConfig) LoadBaseConfigFunction

type Stage

type Stage uint8
const (
	// StageAfterStop after app stop
	StageAfterStop Stage = iota + 1
	// StageBeforeStop before app stop
	StageBeforeStop
)

Jump to

Keyboard shortcuts

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