contracts/job.go
2023-06-05 17:32:10 +08:00

36 lines
481 B
Go

package contracts
import (
"github.com/samber/do"
)
type JobServer interface {
Start() error
Stop() error
Restart() error
}
type JobService interface {
Dispatch(job string, payload any, u User) error
}
type Job interface {
Controller
// 任务处理
Handle(any) error
}
type JobBase struct {
Controller
}
func (JobBase) Handle(any) error {
return nil
}
func NewJobBase(container *do.Injector) Job {
return &JobBase{
Controller: &BaseController{container},
}
}