Versions in this module Expand all Collapse all v0 v0.1.1 May 9, 2023 Changes in this version + var ErrPaperFileExist = errors.New("paper file exist") v0.1.0 May 4, 2023 Changes in this version type File + func (file *File) GetList(f *FileDatabase) (List, error) type FileDatabase + func (f *FileDatabase) GetFilesByYearRange(yearstart, yearend StudyYear) ([]*File, error) + func (f *FileDatabase) GetQuestionByHex(hexid string, istemp bool) (q Question, err error) v0.0.1 Apr 30, 2023 Changes in this version + const DataFolder + const FileFolder + const FileTableFile + const FileTableList + const FileTableQuestion + const FileTableTempFile + const FileTableTempQuestion + const PaperFolder + const UserTableMessage + const UserTableMonthlyAPIVisit + const UserTableRegex + const UserTableUser + var ErrEmptyClass = errors.New("empty class") + var ErrEmptyContact = errors.New("empty contact") + var ErrEmptyName = errors.New("empty name") + var ErrEmptyPassword = errors.New("empty password") + var ErrEmptyRegex = errors.New("empty regex") + var ErrEmptyUserID = errors.New("empty user ID") + var ErrHasntAnalyzed = errors.New("hasn't analyzed") + var ErrInvalidAvatar = errors.New("invalid avatar") + var ErrInvalidContact = errors.New("invalid contact") + var ErrInvalidGenerateConfig = errors.New("invalid generate config") + var ErrInvalidName = errors.New("invalid name") + var ErrInvalidRole = errors.New("invalid role") + var ErrInvalidSaveName = errors.New("invalid save name") + var ErrInvalidUserID = errors.New("invalid user ID") + var ErrInvalidUsersCount = errors.New("invalid users count") + var ErrMajorSplitsTooShort = errors.New("major splits too short") + var ErrMajorTooLarge = errors.New("major too large") + var ErrNoEnoughQuestionToMatchRequire = errors.New("no enough question to match require") + var ErrNoGetFileStatusPermission = errors.New("no get file status permission") + var ErrNoSuchFieldName = errors.New("no such field name") + var ErrNoSuchMajor = errors.New("no such major") + var ErrRateLimitExceeded = errors.New("rate limit exceeded") + var ErrUsernameExists = errors.New("username exists") + var FileDB = FileDatabase + var UserDB = UserDatabase + type File struct + Class string + Date uint32 + ID int64 + ListID int + Questions []byte + Rate string + Time time.Duration + Type PaperType + Year StudyYear + type FileDatabase struct + func (f *FileDatabase) AddFile(lstid int, reg *Regex, istemp bool, progress func(uint)) error + func (f *FileDatabase) DelFile(lstid, uid int, istemp bool) error + func (f *FileDatabase) DelQuestion(id int64, istemp bool) error + func (f *FileDatabase) GenerateFile(config *GenerateConfig) (docf *docx.Docx, err error) + func (f *FileDatabase) GetFile(lstid, uid int) (file *File, sz int64, istemp bool, err error) + func (f *FileDatabase) GetMajors() (majors []string) + func (f *FileDatabase) GetQuestion(id int64, istemp bool) (Question, error) + func (f *FileDatabase) GetQuestionHex(hexid string, istemp bool) (q Question, err error) + func (f *FileDatabase) ListFileByID(id int) (lst List, err error) + func (f *FileDatabase) ListUploadedFile(istemp bool) (lst []*List, err error) + func (f *FileDatabase) SaveFileToTemp(uploader int, file io.Reader, name string) (id int, err error) + type GenerateConfig struct + Distribution map[string]uint + RateLimit float64 + TypeMask PaperType + YearEnd StudyYear + YearStart StudyYear + type List struct + Desc string + HasntAnalyzed bool + ID *int + IsTemp bool + Path string + QuesC int + Size int64 + UpName string + UpTime int64 + Uploader int + type Message struct + Cont string + Date int64 + ID *int + Name string + Pswd string + Text string + ToID int + func (m *Message) Type() MessageType + type MessageType uint8 + const MessageContactChange + const MessageNormal + const MessageOperator + const MessagePasswordChange + const MessageRegister + const MessageResetPassword + const MessageUserAdded + type MonthlyAPIVisit struct + Count uint32 + YM uint32 + type PaperType uint16 + func (pt PaperType) AB() byte + func (pt PaperType) FirstSecond() string + func (pt PaperType) MiddleFinal() string + func (pt PaperType) OpenClose() string + func (pt PaperType) SetAB(x byte) PaperType + func (pt PaperType) SetFirstSecond(x byte) PaperType + func (pt PaperType) SetMiddleFinal(x string) PaperType + func (pt PaperType) SetOpenClose(x string) PaperType + type Question struct + Dup []byte + ID int64 + Images []byte + ListID int + Major string + Path string + Plain string + Vector []byte + func (q *Question) GetDuplicateRate(que *Question) (float64, error) + func (q *Question) MaxDuplicateRate() float64 + type QuestionJSON struct + Name string + Points int + Sub []QuestionJSON + func (q *QuestionJSON) Delete(f *FileDatabase, istemp bool) + type Regex struct + Class string + Date string + ID int + Major string + OpenCl string + Rate string + Sub string + Time string + Title string + func GetDefaultRegex() (reg Regex) + type StudyYear uint16 + func (sy StudyYear) String() string + type User struct + Avtr string + Cont string + Date int64 + Desc string + ID *int + Last int64 + Name string + Nick string + Pswd string + Role UserRole + func (user *User) IsFileManager() bool + func (user *User) IsSuper() bool + func (user *User) IsUser() bool + type UserDatabase struct + func (u *UserDatabase) AddUser(user *User, opname string) error + func (u *UserDatabase) DelMessageByID(id int) (err error) + func (u *UserDatabase) DelUserByID(id int) (err error) + func (u *UserDatabase) DisableUser(id int, opname string) error + func (u *UserDatabase) GetAnnualAPIVisitCount() (cnts [12]uint32) + func (u *UserDatabase) GetMessageByID(id int) (m Message, err error) + func (u *UserDatabase) GetMessagesOfUser(to int) (ms []Message, err error) + func (u *UserDatabase) GetSuperIDs() (ids []int, err error) + func (u *UserDatabase) GetUserByID(id int) (user User, err error) + func (u *UserDatabase) GetUserByName(username string) (user User, err error) + func (u *UserDatabase) GetUserRegex(id int) (*Regex, error) + func (u *UserDatabase) GetUsers() (users []User, err error) + func (u *UserDatabase) GetUsersCount() (int, error) + func (u *UserDatabase) IsIDExists(id int) bool + func (u *UserDatabase) IsNameExists(username string) bool + func (u *UserDatabase) NotifyRegister(ip, name, cont, pswd string) error + func (u *UserDatabase) NotifyResetPassword(ip, name, cont string) error + func (u *UserDatabase) SendMessage(text, opname string, to int) error + func (u *UserDatabase) SetUserRegex(id int, reg *Regex) error + func (u *UserDatabase) UpdateUserContact(id int, opname, ncont string) error + func (u *UserDatabase) UpdateUserInfo(id int, opname, nick, avtr, desc string) error + func (u *UserDatabase) UpdateUserPassword(id int, opname, npwd string) error + func (u *UserDatabase) UpdateUserRole(id int, nr UserRole, opname string) error + func (u *UserDatabase) VisitAPI() + type UserRole uint8 + const RoleFileManager + const RoleNil + const RoleSuper + const RoleTop + const RoleUser + func (r UserRole) IsVaild() bool + func (r UserRole) Nick() string + func (r UserRole) String() string