Documentation
¶
Index ¶
- Constants
- type Task
- type UseCase
- func (uc *UseCase) CreateTask(ctx context.Context, config usecase.TaskConfig) (string, error)
- func (uc *UseCase) GetProgress(taskID string) (map[string]usecase.Progress, error)
- func (uc *UseCase) GetResult(taskID string) (bool, error)
- func (uc *UseCase) Setup() error
- func (uc *UseCase) Teardown() error
- func (uc *UseCase) WaitResult(taskID string) error
- type UseCaseConfig
Constants ¶
View Source
const TTL = 5 * time.Minute
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Task ¶
type Task struct {
ID string
// contains filtered or unexported fields
}
Task type is implementation of one task from usecase.
func NewTask ¶
func NewTask(cfg usecase.TaskConfig) (*Task, error)
NewTask function creates context for one generation job.
type UseCase ¶
type UseCase struct {
// contains filtered or unexported fields
}
UseCase type is implementation of common use case.
func NewUseCase ¶
func NewUseCase(_ UseCaseConfig) *UseCase
NewUseCase function creates UseCase object.
func (*UseCase) CreateTask ¶
CreateTask function receive model from delivery, generate data and send it to output. It works asynchronously and returns string task ID to get results later.
func (*UseCase) GetProgress ¶
GetProgress function returns current progresses of task by ID.
func (*UseCase) WaitResult ¶
WaitResult function waits task by ID end and returns it error.
type UseCaseConfig ¶
type UseCaseConfig struct{}
UseCaseConfig type is used to describe config for common usecase.
Click to show internal directories.
Click to hide internal directories.