Documentation ¶
Index ¶
- Constants
- func Message(serviceName string, msgType string, params ...any) error
- func Restart(serviceName string) error
- func Start(serviceName string) error
- func Stop(serviceName string) error
- type Service
- func (s *Service) Message(t string, params ...any) error
- func (s *Service) Restart(params ...any) error
- func (s *Service) SetDefaultAction(action string) *Service
- func (s *Service) SetEventFunc(eventFunc func(...any)) *Service
- func (s *Service) SetStopFinishedCallback(f func(...any)) *Service
- func (s *Service) SetTimerFunc(timerFunc func(...any)) *Service
- func (s *Service) Start(vs ...any) error
- func (s *Service) Stop() error
- type ServiceMsg
Constants ¶
View Source
const ( //StateStop 未启动 StateStop = 0 //StateRunning 正在运行 StateRunning = 1 //StateStopping 正在结束 StateStopping = 2 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Service ¶
type Service struct { Name string //服务名称 State uint8 //服务状态 //服务运行状态 , 0:未启动 1:正在运行 2:正在结束 NextAction string //动作名称 DefaultAction string //默认动作 TimerFunc func(...any) //定时回调函数 EventFunc func(...any) //事件回调函数 StopFinishedCallback func(...any) //服务停止后的回调函数 Timer *time.Timer // contains filtered or unexported fields }
Service 服务
func (*Service) SetDefaultAction ¶
SetDefaultAction 设置默认action
func (*Service) SetEventFunc ¶
SetEventFunc 设置时间功能函数
func (*Service) SetStopFinishedCallback ¶
SetStopFinishedCallback 设置服务停止后的回调函数
func (*Service) SetTimerFunc ¶
SetTimerFunc 设置定时功能函数
Click to show internal directories.
Click to hide internal directories.