Versions in this module Expand all Collapse all v0 v0.0.2 Nov 22, 2019 Changes in this version + const ApplicationAccepted + const ApplicationFailed + const ApplicationPending + const ApplicationRejected + const ContestAccessPrivate + const ContestAccessRegister + const Correct + const DefaultUserTeamDescription + const DefaultUserTeamPrefix + const FlagTypeStatic + const InvitationAccepted + const InvitationFailed + const InvitationPending + const InvitationRejected + const TableConfig + const TableContest + const TableContestNotification + const TableContestRank + const TableFlag + const TableHint + const TableNotification + const TableProblem + const TableProblemTag + const TableRelContestAdmin + const TableRelProblemSolver + const TableRelProblemTag + const TableRelTeamAdmin + const TableRelTeamSnapshotMember + const TableRelUserTeam + const TableRelUserUnlockedHint + const TableResource + const TableSession + const TableSubmission + const TableTeam + const TableTeamApplication + const TableTeamInvitation + const TableTeamSnapshot + const TableUser + const TableUserProfile + const Wrong + var DefaultContest = Contest + var DefaultUser = User + func GenerateResourceUUID() string + func GenerateSalt() string + func GetConfig(db *gorm.DB, key string) string + func GetContestCount(db *gorm.DB) uint + func GetPasswordHash(password string, salt string) string + func GetProblemID(db *gorm.DB, contestID uint, alias string) (uint, error) + func GetSubmissionCount(db *gorm.DB) uint + func GetUserCount(db *gorm.DB) uint + func HasEmail(db *gorm.DB, email string) bool + func HasPendingApplication(db *gorm.DB, teamID, userID uint) bool + func HasPendingInvitation(db *gorm.DB, teamID, userID uint) bool + func HasProblemAlias(db *gorm.DB, contestID uint, alias string) bool + func HasTeamName(db *gorm.DB, name string) bool + func HasUsername(db *gorm.DB, username string) bool + func IsContestAdmin(db *gorm.DB, contestID, userID uint) bool + func IsTeamMemberByUserID(db *gorm.DB, teamID uint, userID uint) bool + func MigrateSystem(db *gorm.DB) + func SetConfig(db *gorm.DB, key string, value string) + func SetItem() + type Config struct + Key string + Value string + func GetConfigs(db *gorm.DB) []Config + type Contest struct + Access uint + Admins []*User + CreatorID uint + Description string + EndTime time.Time + IsHidden bool + Name string + Notifications []*ContestNotification + Problems []*Problem + Resources []*Resource + StartTime time.Time + TeamSnapshots []*TeamSnapshot + func GetContestByID(db *gorm.DB, id uint) (*Contest, error) + func GetContests(db *gorm.DB) []Contest + func GetContestsFilterByStatus(db *gorm.DB, status uint) []Contest + func GetDefaultContest(db *gorm.DB) *Contest + func NewContest(db *gorm.DB, name string, description string, startTime time.Time, ...) *Contest + func (c *Contest) AddAdmin(db *gorm.DB, user *User) + func (c *Contest) AddNotification(db *gorm.DB, content string) int + func (c *Contest) AddProblem(db *gorm.DB, problem *Problem) + func (c *Contest) AddResource(db *gorm.DB, res *Resource) + func (c *Contest) AddTeam(db *gorm.DB, team *Team, usersID []uint) error + func (c *Contest) Delete(db *gorm.DB) + func (c *Contest) DeleteAdmin(db *gorm.DB, user *User) + func (c *Contest) DeleteTeamByID(db *gorm.DB, teamID uint) error + func (c *Contest) GenerateRank(db *gorm.DB) + func (c *Contest) GetAdmins(db *gorm.DB) []User + func (c *Contest) GetNotificationByOrder(db *gorm.DB, order int) (*ContestNotification, error) + func (c *Contest) GetNotifications(db *gorm.DB, from time.Time, offset uint) []ContestNotification + func (c *Contest) GetProblems(db *gorm.DB) []Problem + func (c *Contest) GetTeamSnapshots(db *gorm.DB) []TeamSnapshot + func (c *Contest) GetTeams(db *gorm.DB) []Team + func (c *Contest) GetUserTeam(db *gorm.DB, user *User) (*Team, error) + func (c *Contest) HasPlayerByUserID(db *gorm.DB, usersID []uint) bool + func (c *Contest) HasTeamByTeamID(db *gorm.DB, teamID uint) bool + func (c *Contest) IsAdmin(db *gorm.DB, user *User) bool + func (c *Contest) IsPlayer(db *gorm.DB, user *User) bool + func (c *Contest) Update(db *gorm.DB) + type ContestNotification struct + Content string + ContestID uint + func (n *ContestNotification) Delete(db *gorm.DB) + type ContestRank struct + ContestID uint + Points uint + Rank uint + TeamID uint + type Flag struct + ProblemID uint + Settings FlagSettings + SettingsPlain []byte + Type string + func (f *Flag) AfterFind() (err error) + func (f *Flag) BeforeSave() (err error) + func (f *Flag) Check(s string) bool + func (f *Flag) Delete(db *gorm.DB) + func (f *Flag) Update(db *gorm.DB) + type FlagSettings interface + Check func(string) bool + FromMap func(*map[string][]string) error + FromPlain func([]byte) error + IsValid func() bool + Plain func() []byte + Type func() string + func NewFlagSettingsFromMap(ft FlagType, m map[string]interface{}) (fs FlagSettings, err error) + type FlagStatic struct + Flag string + func (f *FlagStatic) Check(s string) bool + func (f *FlagStatic) FromMap(m *map[string][]string) error + func (f *FlagStatic) FromPlain(b []byte) error + func (f *FlagStatic) IsValid() bool + func (f *FlagStatic) Plain() (j []byte) + func (f *FlagStatic) Type() string + type FlagType string + type Hint struct + Content string + Cost uint + ProblemID uint + UnlockedUsers []*User + func (h *Hint) Delete(db *gorm.DB) + func (h *Hint) IsUnlocked(db *gorm.DB, contest *Contest, problem *Problem, user *User) bool + func (h *Hint) Unlock(db *gorm.DB, contest *Contest, problem *Problem, user *User) error + func (h *Hint) Update(db *gorm.DB) + type Notification struct + Content string + CreatorID uint + IsRead bool + UserID uint + func GetNotificationByID(db *gorm.DB, id uint) (*Notification, error) + func GetNotifications(db *gorm.DB, offset uint, limit uint) []Notification + func GetUserNotifications(db *gorm.DB, user *User, offset uint) []Notification + func NewNotification(db *gorm.DB, userID uint, content string, creatorID uint) *Notification + func (n *Notification) Delete(db *gorm.DB) + func (n *Notification) Update(db *gorm.DB) + type Problem struct + Alias string + ContestID uint + CreatorID uint + Description string + Flags []*Flag + Hints []*Hint + IsHidden bool + Name string + Points uint + Resources []*Resource + Solvers []*User + Submissions []*Submission + Tags []*ProblemTag + Type string + func GetProblemByAliasAndContestID(db *gorm.DB, alias string, contestID uint) (*Problem, error) + func NewProblem(db *gorm.DB, name string, description string, alias string, contestID uint, ...) *Problem + func (p *Problem) AddFlag(db *gorm.DB, ft FlagType, fs FlagSettings) int + func (p *Problem) AddFlagWithSettingsMap(db *gorm.DB, ft FlagType, m map[string]interface{}) (int, error) + func (p *Problem) AddHint(db *gorm.DB, cost uint, content string) int + func (p *Problem) AddResource(db *gorm.DB, res *Resource) + func (p *Problem) AddSolver(db *gorm.DB, u *User) + func (p *Problem) AddTag(db *gorm.DB, tag string) + func (p *Problem) Delete(db *gorm.DB) + func (p *Problem) DeleteTag(db *gorm.DB, tagName string) + func (p *Problem) GetFlagByOrder(db *gorm.DB, order int) (*Flag, error) + func (p *Problem) GetFlags(db *gorm.DB) []Flag + func (p *Problem) GetHintByOrder(db *gorm.DB, order int) (*Hint, error) + func (p *Problem) GetHints(db *gorm.DB) []Hint + func (p *Problem) GetResources(db *gorm.DB) []Resource + func (p *Problem) GetSolvers(db *gorm.DB) []User + func (p *Problem) GetTags(db *gorm.DB) []ProblemTag + func (p *Problem) GetTagsName(db *gorm.DB) []string + func (p *Problem) Update(db *gorm.DB) + type ProblemTag struct + Name string + Problems []*Problem + type Resource struct + ContentType string + ContestID uint + CreatorID uint + ExpiredAt time.Time + IsHidden bool + Name string + Path string + ProblemID uint + UUID string + func GetContestResources(db *gorm.DB, contestID uint) []Resource + func GetProblemResources(db *gorm.DB, problemID uint) []Resource + func GetResourceByUUID(db *gorm.DB, resourceUUID string) (*Resource, error) + func GetResources(db *gorm.DB) []Resource + func NewResourceWithReader(db *gorm.DB, baseDir string, name string, contentType string, src io.Reader, ...) *Resource + func (res *Resource) Delete(db *gorm.DB) + func (res *Resource) Update(db *gorm.DB) + type Session struct + ExpireAt time.Time + SessionID string + User *User + UserID uint + func GetSessionBySessionID(db *gorm.DB, sessionID string) (*Session, error) + func GetSessions(db *gorm.DB) []Session + func NewSession(db *gorm.DB, u *User, maxAge int) *Session + func (s *Session) Del(rp *redis.Pool, key string) + func (s *Session) Destroy(db *gorm.DB, rp *redis.Pool) + func (s *Session) Get(rp *redis.Pool, key string, value interface{}) + func (s *Session) IsExpired() bool + func (s *Session) IsLoggedIn() bool + func (s *Session) Renew(db *gorm.DB, d time.Duration) + func (s *Session) Set(rp *redis.Pool, key string, value interface{}) + func (s *Session) Update(db *gorm.DB) + type Submission struct + CreatorID uint + Flag string + ProblemID uint + Result uint + func GetSubmissions(db *gorm.DB) []Submission + func NewSubmission(db *gorm.DB, flag string, problem *Problem, user *User) *Submission + type System struct + Key string + Value string + type Team struct + Admins []*User + CreatorID uint + Description string + InvitationToken string + IsDefault bool + Members []*User + Name string + Snapshots []*TeamSnapshot + func GetTeamByID(db *gorm.DB, id uint) (*Team, error) + func GetTeams(db *gorm.DB, query string) []Team + func GetUserTeams(db *gorm.DB, userID uint, admin bool, query string) []Team + func NewTeam(db *gorm.DB, name string, description string, creatorID uint) *Team + func (t *Team) AddAdmin(db *gorm.DB, user *User) + func (t *Team) AddMember(db *gorm.DB, user *User) + func (t *Team) CalcContestPoints(db *gorm.DB, contest *Contest) (points uint) + func (t *Team) Delete(db *gorm.DB) + func (t *Team) DeleteAdmin(db *gorm.DB, user *User) + func (t *Team) DeleteMember(db *gorm.DB, user *User) + func (t *Team) GenerateInvitationToken(db *gorm.DB) + func (t *Team) GetAdmins(db *gorm.DB) []User + func (t *Team) GetContestRank(db *gorm.DB, contest *Contest) (*ContestRank, error) + func (t *Team) GetContests(db *gorm.DB) []Contest + func (t *Team) GetCorrectSubmissions(db *gorm.DB, contest *Contest) []Submission + func (t *Team) GetMembers(db *gorm.DB, query string) []User + func (t *Team) GetMembersCount(db *gorm.DB) uint + func (t *Team) GetSnapshotByContestID(db *gorm.DB, contestID uint) (*TeamSnapshot, error) + func (t *Team) GetSnapshots(db *gorm.DB) []TeamSnapshot + func (t *Team) GetSolvedProblems(db *gorm.DB, contest *Contest) []Problem + func (t *Team) GetUnlockedHints(db *gorm.DB, contest *Contest) []Hint + func (t *Team) IsAdmin(db *gorm.DB, user *User) bool + func (t *Team) IsAdminByUserID(db *gorm.DB, userID uint) bool + func (t *Team) IsAllMemberByUserID(db *gorm.DB, userID []uint) bool + func (t *Team) IsMember(db *gorm.DB, user *User) bool + func (t *Team) IsMemberByUserID(db *gorm.DB, userID uint) bool + func (t *Team) NewSnapshot(db *gorm.DB, contest *Contest, usersID []uint) (*TeamSnapshot, error) + func (t *Team) Update(db *gorm.DB) + type TeamApplication struct + Status uint + TeamID uint + UserID uint + func GetPendingApplication(db *gorm.DB, teamID, userID uint) (*TeamApplication, error) + func GetTeamApplications(db *gorm.DB, teamID uint) []TeamApplication + func GetUserApplications(db *gorm.DB, userID uint) []TeamApplication + func NewTeamApplication(db *gorm.DB, team *Team, userID uint) *TeamApplication + func (app *TeamApplication) Accept(db *gorm.DB) error + func (app *TeamApplication) Delete(db *gorm.DB) + func (app *TeamApplication) Reject(db *gorm.DB) error + func (app *TeamApplication) Update(db *gorm.DB) + type TeamInvitation struct + FromUser uint + Status uint + TeamID uint + ToUser uint + func GetPendingInvitation(db *gorm.DB, teamID, userID uint) (*TeamInvitation, error) + func GetTeamInvitations(db *gorm.DB, teamID uint) []TeamInvitation + func GetUserInvitations(db *gorm.DB, userID uint) []TeamInvitation + func NewTeamInvitation(db *gorm.DB, team *Team, toUserID, fromUserID uint) *TeamInvitation + func (inv *TeamInvitation) Accept(db *gorm.DB) error + func (inv *TeamInvitation) Delete(db *gorm.DB) + func (inv *TeamInvitation) Reject(db *gorm.DB) error + func (inv *TeamInvitation) Update(db *gorm.DB) + type TeamSnapshot struct + ContestID uint + Members []*User + TeamID uint + func (ts *TeamSnapshot) Delete(db *gorm.DB) + func (ts *TeamSnapshot) GetMembers(db *gorm.DB) []User + type User struct + AsContestAdmin []*Contest + AsTeamAdmin []*Team + CreatedContests []*Contest + CreatedProblems []*Problem + CreatedResources []*Resource + CreatedTeams []*Team + DefaultTeam uint + Email string + IsAdmin bool + IsBanned bool + IsHidden bool + PasswordHash string + Profile *UserProfile + SolvedProblems []*Problem + Submissions []*Submission + TeamSnapshots []*TeamSnapshot + Teams []*Team + UnlockedHints []*Hint + Username string + func GetAdmins(db *gorm.DB) []User + func GetUserByID(db *gorm.DB, id uint) (*User, error) + func GetUserByUsername(db *gorm.DB, username string) (*User, error) + func GetUsers(db *gorm.DB) []User + func GetUsersByID(db *gorm.DB, id []uint) []User + func GetUsersWithQuery(db *gorm.DB, offset, limit uint, query string) []User + func NewUser(db *gorm.DB, username string, password string) (*User, error) + func (u *User) CalcPersonalContestPoints(db *gorm.DB, contest *Contest) (points uint) + func (u *User) CalcTeamContestPoints(db *gorm.DB, contest *Contest) (uint, error) + func (u *User) ChangePassword(db *gorm.DB, password string) + func (u *User) Delete(db *gorm.DB) + func (u *User) GetContestTeam(db *gorm.DB, contest *Contest) (*Team, error) + func (u *User) GetSolvedProblems(db *gorm.DB, contest *Contest) []Problem + func (u *User) HasContestAccess(db *gorm.DB, contest *Contest) bool + func (u *User) HasResourceAccess(db *gorm.DB, res *Resource) bool + func (u *User) HasTeamAccess(db *gorm.DB, team *Team) bool + func (u *User) IsContestAdmin(db *gorm.DB, contest *Contest) bool + func (u *User) IsResourceAdmin(res *Resource) bool + func (u *User) IsTeamAdmin(db *gorm.DB, team *Team) bool + func (u *User) MatchPassword(password string) bool + func (u *User) Update(db *gorm.DB) + type UserProfile struct + Description string + Nickname string + Page string + UserID uint v0.0.1 Nov 22, 2019