迁移
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package biz
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type TimedTask struct {
|
||||
ID uint
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
Name, Description, Spec string
|
||||
WithSeconds bool
|
||||
ExecutorType, MethodName string
|
||||
Params []byte
|
||||
HTTPURL, HTTPMethod string
|
||||
HTTPHeader []byte
|
||||
HTTPBody string
|
||||
HTTPAllowPrivate, Enabled bool
|
||||
EnabledFilter *bool
|
||||
}
|
||||
type TimedTaskLog struct {
|
||||
ID uint
|
||||
CreatedAt time.Time
|
||||
TaskID uint
|
||||
TaskName, TriggerType string
|
||||
StartedAt, FinishedAt time.Time
|
||||
DurationMS int64
|
||||
Status, ErrorMsg, Output string
|
||||
}
|
||||
type TaskRepo interface {
|
||||
CreateTask(context.Context, *TimedTask) error
|
||||
UpdateTask(context.Context, *TimedTask) error
|
||||
DeleteTask(context.Context, uint) error
|
||||
FindTask(context.Context, uint) (*TimedTask, error)
|
||||
ListTasks(context.Context, int, int, *TimedTask) ([]*TimedTask, int64, error)
|
||||
ToggleTask(context.Context, uint, bool) error
|
||||
RecordTaskLog(context.Context, *TimedTaskLog) error
|
||||
ListTaskLogs(context.Context, int, int, uint, string) ([]*TimedTaskLog, int64, error)
|
||||
CleanupLogs(context.Context, time.Time) error
|
||||
}
|
||||
type TaskUsecase struct{ repo TaskRepo }
|
||||
|
||||
func NewTaskUsecase(repo TaskRepo) *TaskUsecase { return &TaskUsecase{repo: repo} }
|
||||
func (uc *TaskUsecase) Repo() TaskRepo { return uc.repo }
|
||||
Reference in New Issue
Block a user