general

package
v0.0.0-...-732dc05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

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.

func (*Task) GetError

func (t *Task) GetError() (bool, error)

func (*Task) GetProgress

func (t *Task) GetProgress() map[string]usecase.Progress

func (*Task) RunTask

func (t *Task) RunTask(ctx context.Context, callback func())

RunTask function generates unique values and then all values for selected model.

func (*Task) WaitError

func (t *Task) WaitError() error

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

func (uc *UseCase) CreateTask(ctx context.Context, config usecase.TaskConfig) (string, error)

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

func (uc *UseCase) GetProgress(taskID string) (map[string]usecase.Progress, error)

GetProgress function returns current progresses of task by ID.

func (*UseCase) GetResult

func (uc *UseCase) GetResult(taskID string) (bool, error)

GetResult function returns error of task by ID.

func (*UseCase) Setup

func (uc *UseCase) Setup() error

Setup function do nothing.

func (*UseCase) Teardown

func (uc *UseCase) Teardown() error

Teardown function wait all generation processes.

func (*UseCase) WaitResult

func (uc *UseCase) WaitResult(taskID string) error

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.

Directories

Path Synopsis
en
ru

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL