Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GraceGrpc ¶
type GraceGrpc struct { // Addr grpc地址, eg: ":7777" Addr string Server *grpc.Server // RegisterReflect 启动grpc反射 RegisterReflect bool // EnableGateway 启动grpc gateway, 该字段不会生效, 只是起到占位作用 EnableGateway bool // GatewayAddr gateway的地址, eg: ":8888", 该字段不会生效, 只是起到占位作用 GatewayAddr string OnHookFunc }
GraceGrpc grpc启动配置
func NewGraceGrpc ¶
func NewGraceGrpc() *GraceGrpc
type GraceHttp ¶
type GraceHttp struct { Engine http.Handler // Addr 地址 Addr string `json:"addr" yaml:"addr"` // WaitSecond 等待时间 WaitSecond int `json:"waitTime" yaml:"waitTime"` OnHookFunc }
type HookHandler ¶
type HookHandler func() error
type OnHookFunc ¶
type OnHookFunc struct { // StartUp 服务启动前执行函数 StartUp []HookHandler // ShutDown 停止服务执行函数 ShutDown []HookHandler }
OnHookFunc 勾子结构体
func NewOnHookFunc ¶ added in v1.2.3
func NewOnHookFunc() *OnHookFunc
func (OnHookFunc) ExecuteShutDown ¶
func (h OnHookFunc) ExecuteShutDown() error
ExecuteShutDown 执行结束后操作
func (OnHookFunc) ExecuteStartUp ¶
func (h OnHookFunc) ExecuteStartUp() error
ExecuteStartUp 执行启动前操作
Click to show internal directories.
Click to hide internal directories.