refactor: rename model

This commit is contained in:
Jason Song
2022-12-06 13:48:09 +08:00
parent f2c7bbb0bc
commit c07d0c1768
21 changed files with 180 additions and 180 deletions

View File

@@ -12,7 +12,7 @@ import (
"xorm.io/builder"
)
type TaskList []*BotTask
type TaskList []*ActionTask
func (tasks TaskList) GetJobIDs() []int64 {
jobIDsMap := make(map[int64]struct{})
@@ -31,7 +31,7 @@ func (tasks TaskList) GetJobIDs() []int64 {
func (tasks TaskList) LoadJobs(ctx context.Context) error {
jobIDs := tasks.GetJobIDs()
jobs := make(map[int64]*BotRunJob, len(jobIDs))
jobs := make(map[int64]*ActionRunJob, len(jobIDs))
if err := db.GetEngine(ctx).In("id", jobIDs).Find(&jobs); err != nil {
return err
}
@@ -41,7 +41,7 @@ func (tasks TaskList) LoadJobs(ctx context.Context) error {
}
}
var jobsList RunJobList = make([]*BotRunJob, 0, len(jobs))
var jobsList ActionJobList = make([]*ActionRunJob, 0, len(jobs))
for _, j := range jobs {
jobsList = append(jobsList, j)
}
@@ -104,5 +104,5 @@ func FindTasks(ctx context.Context, opts FindTaskOptions) (TaskList, int64, erro
}
func CountTasks(ctx context.Context, opts FindTaskOptions) (int64, error) {
return db.GetEngine(ctx).Where(opts.toConds()).Count(new(BotTask))
return db.GetEngine(ctx).Where(opts.toConds()).Count(new(ActionTask))
}