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) GenerateDownloadToken(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
- func (s TaskService) ValidateDownloadToken(ctx context.Context, tokenString string, id 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)) ErrTaskTypeInvalid = apperr.New("invalid_task_type", apperr.WithTextTranslate(translator.Translate{translator.RU: "Только export задачи могут генерировать ссылки для скачивания", translator.EN: "Only export tasks can generate download links"}), apperr.WithCode(code.Aborted)) ErrTaskStatusInvalid = apperr.New("invalid_task_status", apperr.WithTextTranslate(translator.Translate{translator.RU: "Задача все еще находится в исполнении", translator.EN: "The task is still in progress"}), apperr.WithCode(code.Aborted)) ErrGenerateToken = apperr.New("token_generation_failed", apperr.WithTextTranslate(translator.Translate{translator.RU: "Не удалось сгенерировать токен", translator.EN: "Failed to generate token"}), apperr.WithCode(code.Internal)) ErrInvalidLink = apperr.New("invalid_link") )
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) GenerateDownloadToken(ctx context.Context, id int) (string, error) ValidateDownloadToken(ctx context.Context, token string, id int) error }
type TaskCreateInput ¶
type TaskService ¶
type TaskService struct {
// contains filtered or unexported fields
}
func NewTaskService ¶
func NewTaskService( taskRepository repository.ITaskRepository, services Consumers, queue Queue, tokenSecret string, ) TaskService
func (TaskService) Create ¶
func (s TaskService) Create(ctx context.Context, input TaskCreateInput) (*model.Task, error)
func (TaskService) GenerateDownloadToken ¶ added in v2.3.15
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 ¶
func (TaskService) ValidateDownloadToken ¶ added in v2.3.15
type TaskUpdateInput ¶
Click to show internal directories.
Click to hide internal directories.