Documentation
¶
Index ¶
- func CalcUserActiveByUser(userID uint) (monthlyActive, weeklyActive int, err error)
- func CasbinSetup()
- func CheckUser(username, password string) (id uint, err error)
- func CreateAdmin() error
- func CreateContest(contest *Contest) error
- func CreateContestant(contestant *Contestant) error
- func CreateTeam(team *Team) error
- func CreateUser(user User) error
- func DeleteContest(id uint) error
- func DeleteContestant(id uint) error
- func DeleteTeam(id uint) error
- func DeleteUser(id uint) error
- func GetTagCountsByUser(userID uint) (map[string]int, error)
- func GetUserIdByCfHandle(cfHandle string) (uint, error)
- func OJCreateContest(contest *OJContest) error
- func Setup()
- func UpdateContest(contest *Contest) error
- func UpdateContestant(contestant *Contestant) error
- func UpdatePassword(id uint, password string) error
- func UpdateTeam(team *Team) error
- func UpdateUser(user User) error
- func UpdateUserAvatar(id uint, avatar string) error
- func UpdateUserRole(id uint, role string) error
- type Contest
- type Contestant
- type OJContest
- type OJSubmission
- type ProblemTag
- type Site
- type SiteType
- type Team
- type User
- type UserStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcUserActiveByUser ¶
func CasbinSetup ¶
func CasbinSetup()
func CreateAdmin ¶
func CreateAdmin() error
func CreateContest ¶
func CreateContestant ¶
func CreateContestant(contestant *Contestant) error
func CreateTeam ¶
func CreateUser ¶
func DeleteContest ¶
func DeleteContestant ¶
func DeleteTeam ¶
func DeleteUser ¶
func GetTagCountsByUser ¶
Function to calculate the count of submissions for each tag by a single user
func GetUserIdByCfHandle ¶
func OJCreateContest ¶
OJCreateContest function to create a contest
func UpdateContest ¶
func UpdateContestant ¶
func UpdateContestant(contestant *Contestant) error
func UpdatePassword ¶
func UpdateTeam ¶
func UpdateUser ¶
func UpdateUserAvatar ¶
func UpdateUserRole ¶
Types ¶
type Contest ¶
type Contest struct { gorm.Model Name string `gorm:"not null;unique" json:"name"` StartTime time.Time `json:"startTime"` EndTime time.Time `json:"endTime"` Desc string `gorm:"type:text" json:"desc"` Teams []Team `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"teams"` }
func GetAllContestList ¶
func GetContestInfo ¶
type Contestant ¶
type OJContest ¶
type OJContest struct { gorm.Model Name string `json:"name"` ContestID int `json:"contestID"` OJ string `json:"oj"` Type string `json:"type"` DurationSeconds int `json:"durationSeconds"` StartTime time.Time `json:"startTime"` }
OJContest struct definition
func GetContestsByMonth ¶
GetContestsByMonth function to get contests by month
func GetContestsWithTime ¶
GetContestsWithTime function to get contests within a time range
func OJGetContests ¶
OJGetContests function to get all contests
type OJSubmission ¶
type OJSubmission struct { gorm.Model Name string `gorm:"not null" json:"name"` UserID uint `gorm:"not null" json:"userID"` Rating int `json:"rating"` Tags []ProblemTag `gorm:"many2many:oj_submission_problem_tags;constraint:OnDelete:CASCADE;" json:"tags"` Verdict string `json:"verdict"` OJ string `json:"oj"` Time time.Time `json:"time"` }
func GetAllSubmissionsByUser ¶
func GetAllSubmissionsByUser(userId uint) (submissions []OJSubmission, err error)
func GetSubmissionByTime ¶
func GetSubmissionByTime(startTime, endTime time.Time) (submissions []OJSubmission, err error)
func GetUserSubmissionByTime ¶
func GetUserSubmissionByTime(userId uint, startTime, endTime time.Time) (submissions []OJSubmission, err error)
func (*OJSubmission) Create ¶
func (submission *OJSubmission) Create() error
Create a new OJSubmission
func (*OJSubmission) Delete ¶
func (submission *OJSubmission) Delete() error
Delete an OJSubmission by ID (Unscoped and remove associations)
func (*OJSubmission) GetByID ¶
func (submission *OJSubmission) GetByID(id uint) error
Get an OJSubmission by ID
func (*OJSubmission) Update ¶
func (submission *OJSubmission) Update() error
Update an existing OJSubmission
type ProblemTag ¶
func GetAllTags ¶
func GetAllTags() (tags []ProblemTag, err error)
func (*ProblemTag) Delete ¶
func (tag *ProblemTag) Delete() error
Delete a ProblemTag by ID (Unscoped and remove associations)
type Site ¶
type Site struct { gorm.Model Host string `gorm:"not null;unique" json:"host" binding:"required"` Name string `gorm:"not null;unique" json:"name" binding:"required"` SiteTypeID uint `gorm:"not null" json:"siteTypeID" binding:"required"` SiteType SiteType `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"siteType"` Desc string `gorm:"type:text" json:"desc"` }
func GetAllSiteList ¶
GetAllSiteList retrieves all Site records from the database, including their associated SiteTypes.
type SiteType ¶
type SiteType struct { gorm.Model Name string `gorm:"not null;unique" json:"name" binding:"required"` Desc string `gorm:"type:text" json:"desc"` }
func GetAllSiteTypeList ¶
GetAllSiteTypeList retrieves all SiteType records from the database.
func (*SiteType) Delete ¶
Delete removes a SiteType record from the database, including associations.
type Team ¶
type Team struct { gorm.Model ContestID uint ZhName string `gorm:"not null;unique" json:"zhName"` EnName string `json:"enName"` CoachID uint `gorm:"foreignKey:UserID" json:"coachID"` Coach User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"coach"` Contestants []Contestant `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"contestants"` Desc string `gorm:"type:text" json:"desc"` }
type User ¶
type User struct { gorm.Model Username string `gorm:"size:255;not null;unique" json:"username" binding:"required"` RealName string `gorm:"size:30" json:"realname" binding:"required"` Email string `gorm:"size:255;not null;unique" json:"email" binding:"required"` Sex bool `json:"sex"` StudentID string `gorm:"size:30" json:"studentID"` Class string `gorm:"size:30" json:"class"` Phone string `gorm:"size:30" json:"phone"` CFHandle string `gorm:"size:255" json:"cfHandle"` ATCHandle string `gorm:"size:255" json:"atcHandle"` Avatar string `gorm:"size:255" json:"avatar"` Desc string `gorm:"type:text" json:"desc"` Password string `gorm:"size:255;not null" json:"-"` Role string `gorm:"size:30;not null" json:"role"` OJSubmissions []OJSubmission `gorm:"constraint:OnDelete:CASCADE;" json:"-"` }
func GetACMersList ¶
func GetAllTeachersList ¶
func GetAllUsersList ¶
func GetUserByCfHandle ¶
func GetUserInfo ¶
type UserStatus ¶
type UserStatus struct { gorm.Model UserID uint `json:"-" gorm:"constraint:OnDelete:CASCADE;"` CFRating int `json:"cfRating"` CFWeeklyRating int `json:"weeklyRating"` CFMonthlyRating int `json:"monthlyRating"` WeeklyActive int `json:"weeklyActive"` MonthlyActive int `json:"monthlyActive"` }
func GetAllUserStatusList ¶
func GetAllUserStatusList() (statusList []UserStatus, err error)
func (*UserStatus) Create ¶
func (status *UserStatus) Create() error
func (*UserStatus) Delete ¶
func (status *UserStatus) Delete() error
func (*UserStatus) GetByUserID ¶
func (status *UserStatus) GetByUserID(userID uint) error
func (*UserStatus) Update ¶
func (status *UserStatus) Update() error
func (*UserStatus) UpdateByCFHandle ¶
func (status *UserStatus) UpdateByCFHandle(cfHandle string) error