boot

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootServe added in v0.0.3

func BootServe(instance Instance) error

BootServe 启动服务

func NewGrpcClientConn added in v0.0.3

func NewGrpcClientConn(serviceName string, config *viper.Viper) (*grpc.ClientConn, error)

NewGrpcClientConn 获取GrpcConn,根据配置

Types

type BaseInstance

type BaseInstance struct {
	Config    *viper.Viper
	Addr      string // 监听地址
	IntanceID int64  // 实例ID
}

BaseInstance 基础实例结构

func (*BaseInstance) Init

func (b *BaseInstance) Init() error

Init 初始化

type BaseService added in v0.0.3

type BaseService struct {
	BaseInstance

	Name string // 服务名称

	Listener   net.Listener // 网络监听
	GrpcServer *grpc.Server // GRPC服务端
	// contains filtered or unexported fields
}

BaseService service的基础服务

func (*BaseService) Init added in v0.0.3

func (s *BaseService) Init() error

func (*BaseService) Start added in v0.0.3

func (s *BaseService) Start() error

func (*BaseService) Stop added in v0.0.3

func (s *BaseService) Stop()

type Instance

type Instance interface {
	// Start 开启方法
	Start() error

	// 初始化
	Init() error

	// Stop 结束方法
	Stop()
}

Instance 定义一个实例

Jump to

Keyboard shortcuts

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