35 lines
725 B
Go
35 lines
725 B
Go
|
package models
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||
|
)
|
||
|
|
||
|
type TestingStrategy int32
|
||
|
|
||
|
const (
|
||
|
EachTestTS TestingStrategy = 1
|
||
|
CompleteGroupTS TestingStrategy = 2
|
||
|
)
|
||
|
|
||
|
type Testgroup struct {
|
||
|
Id *int32 `db:"id"`
|
||
|
ProblemId *int32 `db:"problem_id"`
|
||
|
TestingStrategy *TestingStrategy `db:"testing_strategy"`
|
||
|
}
|
||
|
|
||
|
type TestGroupData struct {
|
||
|
Ts TestingStrategy
|
||
|
TestAmount int32
|
||
|
}
|
||
|
|
||
|
var ErrBadTestingStrategy = errors.New("bad testing strategy")
|
||
|
|
||
|
func (ts TestingStrategy) Valid() error {
|
||
|
switch ts {
|
||
|
case EachTestTS, CompleteGroupTS:
|
||
|
return nil
|
||
|
}
|
||
|
return lib.ServiceError(ErrBadTestingStrategy, lib.ErrValidationFailed, "bad testing strategy")
|
||
|
}
|