gitee.com/woood2/luca@v1.0.4/cmd/cron/internal/job/job.go (about) 1 package job 2 3 import "context" 4 5 type Job struct { 6 Name string 7 Spec string 8 Cmd HandlerFunc 9 } 10 11 func (j *Job) Run() { 12 ctx, cancel := context.WithCancel(context.Background()) 13 defer cancel() 14 j.Cmd(ctx) 15 } 16 17 type HandlerFunc func(ctx context.Context) 18 type Middleware func(next HandlerFunc) HandlerFunc