1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-20 02:16:22 +08:00

user.db add table Regex

This commit is contained in:
源文雨
2023-03-22 22:32:51 +08:00
parent 0756b36633
commit e0161613dd
2 changed files with 92 additions and 7 deletions

View File

@@ -52,9 +52,9 @@ func (pt PaperType) MiddleFinal() string {
func (pt PaperType) SetMiddleFinal(x string) PaperType {
n := PaperType(0)
switch x {
case "中":
case "中":
n = 1 << 4
case "末":
case "末":
n = 2 << 4
}
return pt | n
@@ -72,12 +72,12 @@ func (pt PaperType) FirstSecond() string {
}
}
func (pt PaperType) SetFirstSecond(x string) PaperType {
func (pt PaperType) SetFirstSecond(x byte) PaperType {
n := PaperType(0)
switch x {
case "第1学期":
case '1':
n = 1 << 8
case "第2学期":
case '2':
n = 2 << 8
}
return pt | n
@@ -151,6 +151,9 @@ type File struct {
Year StudyYear
Type PaperType
Date uint32 // Date is the yyyymmdd of 考试日期
UID int // UID is the uploader's ID
UpTime int64 // UpTime is time.Now().Unix() when uploading
Size int64 // Size of the original file
Time time.Duration // Time is 考试时长
Class string // Class is 考试科目
Rate string // Rate is 成绩构成比例
@@ -158,8 +161,6 @@ type File struct {
Questions []byte // Questions is for json struct QuestionJSON
}
func (f *FileDatabase) AddFile() {}
// QuestionJSON is the struct representation of File.Questions
type QuestionJSON struct {
Name string `json:"name"` // Name is name or Question ID