Skip to content

Commit

Permalink
refactor: move TaskJob to job.go
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwlin committed Aug 27, 2024
1 parent e83a258 commit 02b0c69
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
21 changes: 21 additions & 0 deletions job.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,24 @@ func (job Job) Wait() bool {
}
return job.Success()
}

type TaskJob struct {
Job
setParamFunc func(id int64, param string) bool
}

func NewTaskJob(id int64, statusFunc func(id int64) Status, setParamFunc func(id int64, param string) bool) TaskJob {
job := NewJob(id, statusFunc)
return TaskJob{
Job: job,
setParamFunc: setParamFunc,
}
}

func (job TaskJob) SetParam(param string) bool {
return job.setParamFunc(job.id, param)
}

func (job TaskJob) GetDetail() (TaskDetail, bool) {
return QueryTaskDetail(job.id)
}
22 changes: 0 additions & 22 deletions task_job.go

This file was deleted.

0 comments on commit 02b0c69

Please sign in to comment.