Documentation
¶
Index ¶
- Variables
- type Consumer
- type Consumers
- type ITaskService
- type Queue
- type TaskCreateInput
- type TaskService
- func (s TaskService) Create(ctx context.Context, input TaskCreateInput) (*model.Task, error)
- func (s TaskService) Download(ctx context.Context, id int) (string, error)
- func (s TaskService) GetById(ctx context.Context, id int) (*model.Task, error)
- func (s TaskService) GetFull(ctx context.Context, taskID *int, statuses ...string) ([]model.Task, error)
- func (s TaskService) List(ctx context.Context, m *model2.Meta[model.Task]) error
- func (s TaskService) Rerun(ctx context.Context, id int) (*model.Task, error)
- func (s TaskService) RunTasks(ctx context.Context, statuses []string, ids ...int) error
- func (s TaskService) Stop(ctx context.Context, id int) error
- func (s TaskService) Trx(db *gorm.DB) ITaskService
- func (s TaskService) Update(ctx context.Context, id int, input TaskUpdateInput) error
- func (s TaskService) UpdateStatus(ctx context.Context, status string, ids ...int) error
- type TaskUpdateInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTaskNotFound = apperr.New("task_not_found", apperr.WithTextTranslate(translator.Translate{translator.RU: "Задача не найдена", translator.EN: "Task not found"}), apperr.WithCode(code.NotFound)) ErrTaskTypeNotFound = apperr.New("task_type_not_found", apperr.WithTextTranslate(translator.Translate{translator.RU: "Тип задачи не найден", translator.EN: "Task's type not found"}), apperr.WithCode(code.NotFound)) ErrTaskCannotStop = apperr.New("task_cannot_stop", apperr.WithTextTranslate(translator.Translate{translator.RU: "Невозможно остановить завершенную задачу", translator.EN: "Cannot stop a completed task"}), apperr.WithCode(code.NotFound)) ErrTaskUnableRerun = apperr.New("task_unable_rerun", apperr.WithTextTranslate(translator.Translate{translator.RU: "Невозможно запустить незавершенную задачу", translator.EN: "Unable to rerun an unfinished task"}), apperr.WithCode(code.NotFound)) ErrTaskFileNotFound = apperr.New("task_file_not_found", apperr.WithTextTranslate(translator.Translate{translator.RU: "Файл не найден", translator.EN: "File not found"}), apperr.WithCode(code.NotFound)) ErrTaskFileStillOngoing = apperr.New("task_file_process", apperr.WithTextTranslate(translator.Translate{translator.RU: "Задача все еще выполняется", translator.EN: "The task is still ongoing"}), apperr.WithCode(code.NotFound)) )
Functions ¶
This section is empty.
Types ¶
type ITaskService ¶
type ITaskService interface { Trx(db *gorm.DB) ITaskService List(ctx context.Context, m *model2.Meta[model.Task]) error GetFull(ctx context.Context, taskID *int, statuses ...string) ([]model.Task, error) Update(ctx context.Context, id int, input TaskUpdateInput) error UpdateStatus(ctx context.Context, status string, ids ...int) error Create(ctx context.Context, input TaskCreateInput) (*model.Task, error) GetById(ctx context.Context, id int) (*model.Task, error) Stop(ctx context.Context, id int) error Rerun(ctx context.Context, id int) (*model.Task, error) RunTasks(ctx context.Context, statuses []string, ids ...int) error Download(ctx context.Context, id int) (string, error) }
type TaskCreateInput ¶
type TaskService ¶
type TaskService struct {
// contains filtered or unexported fields
}
func NewTaskService ¶
func NewTaskService( taskRepository repository.ITaskRepository, services Consumers, queue Queue, ) TaskService
func (TaskService) Create ¶
func (s TaskService) Create(ctx context.Context, input TaskCreateInput) (*model.Task, error)
func (TaskService) Trx ¶
func (s TaskService) Trx(db *gorm.DB) ITaskService
func (TaskService) Update ¶
func (s TaskService) Update(ctx context.Context, id int, input TaskUpdateInput) error
func (TaskService) UpdateStatus ¶
type TaskUpdateInput ¶
Click to show internal directories.
Click to hide internal directories.