2024-02-19 16:33:15 +00:00
|
|
|
package workers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-02-19 17:43:47 +00:00
|
|
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
2024-02-19 16:33:15 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Deps struct {
|
|
|
|
Queries *sqlcgen.Queries
|
|
|
|
}
|
|
|
|
|
|
|
|
type WorkerRepository struct {
|
|
|
|
queries *sqlcgen.Queries
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewWorkerRepository(deps Deps) *WorkerRepository {
|
|
|
|
return &WorkerRepository{
|
|
|
|
queries: deps.Queries,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// test +
|
|
|
|
func (r *WorkerRepository) WorkerStatProcess(ctx context.Context) error {
|
|
|
|
err := r.queries.WorkerStatProcess(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// test +
|
|
|
|
func (r *WorkerRepository) WorkerTimeoutProcess(ctx context.Context) error {
|
|
|
|
err := r.queries.WorkerTimeoutProcess(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|