qservice

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrors added in v0.0.8

func GetErrors(moduleName string, lineCount int) string

Types

type Args added in v0.0.8

type Args struct {
	Module     string
	Broker     qdefine.BrokerConfig
	DeviceCode string
	DeviceName string
	ConfigPath string
	LogPath    string
}

type EServerMode added in v0.0.7

type EServerMode string
const (
	EModeClient EServerMode = "client"
	EModeServer EServerMode = "server"
)

func (EServerMode) IsClient added in v0.0.7

func (mode EServerMode) IsClient() bool

func (EServerMode) IsServer added in v0.0.7

func (mode EServerMode) IsServer() bool

type LogConfig added in v0.0.8

type LogConfig struct {
	Path        string
	RemainDay   int
	RemainLevel int
}

type MicroService

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

func NewService

func NewService(setting *Setting) *MicroService

NewService 创建服务

func (*MicroService) Adapter added in v0.0.7

func (serv *MicroService) Adapter() easyCon.IAdapter

Adapter 获取访问器

func (*MicroService) ResetClient

func (serv *MicroService) ResetClient()

ResetClient 重置客户端

func (*MicroService) Run

func (serv *MicroService) Run()

Run 启动服务

func (*MicroService) SendAlarm added in v0.0.8

func (serv *MicroService) SendAlarm(alarmType string, alarmValue string) error

func (*MicroService) SendLog

func (serv *MicroService) SendLog(logType qdefine.ELog, content string, err error)

SendLog 发送日志

func (*MicroService) SendNotice

func (serv *MicroService) SendNotice(route string, content any)

SendNotice 发送通知

func (*MicroService) SendRequest

func (serv *MicroService) SendRequest(module, route string, params any) (qdefine.Context, error)

SendRequest 向服务器其他模块发送请求,单机两者效果一致

func (*MicroService) Setting

func (serv *MicroService) Setting() Setting

Setting 获取设置

func (*MicroService) Stop added in v0.0.8

func (serv *MicroService) Stop()

Stop 停止

type Setting

type Setting struct {
	Mode           EServerMode          // 路由模式
	Module         string               // 模块服务名称
	Desc           string               // 模块服务描述
	Version        string               // 模块服务版本
	DevCode        string               // 设备码
	Broker         qdefine.BrokerConfig // 主服务配置
	DetectedRoutes []string             // 需要对外暴露的方法列表
	// contains filtered or unexported fields
}

Setting 模块配置

func NewSetting

func NewSetting(moduleName, moduleDesc, version string) *Setting

NewSetting 创建模块配置

func (*Setting) BindCommStateFunc added in v0.0.4

func (s *Setting) BindCommStateFunc(onStateHandler qdefine.StateHandler) *Setting

func (*Setting) BindInitFunc

func (s *Setting) BindInitFunc(onInitHandler qdefine.InitHandler) *Setting

func (*Setting) BindNoticeFunc

func (s *Setting) BindNoticeFunc(onNoticeHandler qdefine.NoticeHandler) *Setting

func (*Setting) BindReqFunc

func (s *Setting) BindReqFunc(onReqHandler qdefine.ReqHandler) *Setting

func (*Setting) BindRespDetectedFunc added in v0.0.8

func (s *Setting) BindRespDetectedFunc(onDetectedHandler qdefine.DetectedHandler) *Setting

func (*Setting) ReloadByCustomArgs added in v0.0.8

func (s *Setting) ReloadByCustomArgs(args Args)

Jump to

Keyboard shortcuts

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