1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-21 19:13:22 +08:00

implement genfile

This commit is contained in:
源文雨
2023-04-22 21:31:12 +08:00
parent 9d9e04ebd2
commit 2e44127672
16 changed files with 898 additions and 404 deletions

View File

@@ -0,0 +1,24 @@
package global
import "errors"
var (
ErrInvalidGenerateConfig = errors.New("invalid generate config")
)
// GenerateConfig 试卷生成配置
type GenerateConfig struct {
Distribution map[string]uint // Distribution is map[majorname]subcount
RateLimit float64 // RateLimit 重复率上限
YearStart StudyYear // YearStart 起始年份(空则直到最旧)
YearEnd StudyYear // YearEnd 截止年份(空则直到最新)
TypeMask PaperType // TypeMask & File.Type != 0 则匹配
}
// GenerateFile 用一些限定条件生成新试卷, 云端不保存
func (f *FileDatabase) GenerateFile(config *GenerateConfig) ([]byte, error) {
if config == nil || config.Distribution == nil {
return nil, ErrInvalidGenerateConfig
}
return nil, nil
}