ms-tester/internal/models/testgroup.go

30 lines
583 B
Go
Raw Normal View History

2024-08-17 10:43:15 +00:00
package models
2024-08-20 22:54:46 +00:00
import "git.sch9.ru/new_gate/ms-tester/internal/lib"
2024-08-17 10:43:15 +00:00
type TestingStrategy int32
const (
2024-08-20 22:54:46 +00:00
EachTestTS TestingStrategy = 1
CompleteGroupTS TestingStrategy = 2
2024-08-17 10:43:15 +00:00
)
type Testgroup struct {
2024-08-20 22:54:46 +00:00
Id *int32 `db:"id"`
ProblemId *int32 `db:"problem_id"`
TestingStrategy *TestingStrategy `db:"testing_strategy"`
2024-08-18 13:41:08 +00:00
}
2024-08-20 22:54:46 +00:00
type TestGroupData struct {
Ts TestingStrategy
TestAmount int32
2024-08-17 10:43:15 +00:00
}
2024-08-20 22:54:46 +00:00
func (ts TestingStrategy) Valid() error {
2024-08-17 10:43:15 +00:00
switch ts {
case EachTestTS, CompleteGroupTS:
return nil
}
return lib.ErrBadTestingStrategy
}