Documentation
¶
Overview ¶
Package service 服务管理
Index ¶
- type Func
- type Server
- func (srv *Server) Add(title localeutil.LocaleStringer, f Servicer)
- func (srv *Server) AddAt(title string, f scheduled.JobFunc, ti time.Time, delay bool)
- func (srv *Server) AddCron(title string, f scheduled.JobFunc, spec string, delay bool)
- func (srv *Server) AddFunc(title localeutil.LocaleStringer, f func(context.Context) error)
- func (srv *Server) AddJob(title string, f scheduled.JobFunc, scheduler scheduled.Scheduler, delay bool)
- func (srv *Server) AddTicker(title string, f scheduled.JobFunc, dur time.Duration, imm, delay bool)
- func (srv *Server) Jobs() []*scheduled.Job
- func (srv *Server) Run()
- func (srv *Server) Running() bool
- func (srv *Server) Services() []*Service
- func (srv *Server) Stop()
- type Service
- type Servicer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Add ¶
func (srv *Server) Add(title localeutil.LocaleStringer, f Servicer)
Add 添加新的服务
f 表示服务的运行函数; title 是对该服务的简要说明。
NOTE: 如果所有服务已经处于运行的状态,则会自动运行新添加的服务。
func (*Server) AddAt ¶
AddAt 添加新的定时任务
f 表示服务的运行函数; title 是对该服务的简要说明; t 指定的时间点; delay 是否在任务执行完之后,才计算下一次的执行时间点。
func (*Server) AddCron ¶
AddCron 添加新的定时任务
f 表示服务的运行函数; title 是对该服务的简要说明; spec cron 表达式,支持秒; delay 是否在任务执行完之后,才计算下一次的执行时间点。
func (*Server) AddFunc ¶ added in v0.66.0
func (srv *Server) AddFunc(title localeutil.LocaleStringer, f func(context.Context) error)
func (*Server) AddJob ¶
func (srv *Server) AddJob(title string, f scheduled.JobFunc, scheduler scheduled.Scheduler, delay bool)
AddJob 添加新的计划任务
f 表示服务的运行函数; title 是对该服务的简要说明; scheduler 计划任务的时间调度算法实现; delay 是否在任务执行完之后,才计算下一次的执行时间点。
Click to show internal directories.
Click to hide internal directories.