Documentation
¶
Index ¶
- Constants
- Variables
- func FakeDatabase()
- func FakeMatches()
- func InitializeRedis(client *redis.Client)
- func InitializeSchemata(dbInput *sql.DB)
- func SubmissionHistory(uid int32, cid int32, limit, offset int) ([]map[string]interface{}, int, error)
- type Contest
- func (c *Contest) AllParticipations() ([]ContestParticipation, error)
- func (c *Contest) AllParticipationsRequiresDelegate(d bool) ([]ContestParticipation, error)
- func (c *Contest) AllParticipationsWithDelegate() ([]ContestParticipation, error)
- func (c *Contest) AppendScriptLog(s string) error
- func (c *Contest) Create() error
- func (c *Contest) ExecuteMatchScriptFunction(fnName string, args ...lua.LValue) error
- func (c *Contest) ExecuteMatchScriptOnManual(arg string) error
- func (c *Contest) ExecuteMatchScriptOnSubmission(from int32) error
- func (c *Contest) ExecuteMatchScriptOnTimer() error
- func (c *Contest) HasEnded() bool
- func (c *Contest) HasStarted() bool
- func (c *Contest) IsRunning() bool
- func (c *Contest) IsVisibleTo(u User) bool
- func (c *Contest) LoadBanner() (File, error)
- func (c *Contest) LoadPlayback() error
- func (c *Contest) LoadRel() error
- func (c *Contest) LuaState() *lua.LState
- func (c *Contest) PartParticipation(limit, offset int) ([]ContestParticipation, int, error)
- func (c *Contest) ParticipationOf(u User) int8
- func (c *Contest) Read() error
- func (c *Contest) ReadModerators() []int32
- func (c *Contest) ReadScriptLog() (error, string)
- func (c *Contest) Representation(u User) map[string]interface{}
- func (c *Contest) ResetLuaState()
- func (c *Contest) ShortRepresentation(u User) map[string]interface{}
- func (c *Contest) TailLog() string
- func (c *Contest) Update() error
- func (c *Contest) UpdateBanner() error
- func (c *Contest) UpdateModerators(uids []int64) error
- type ContestParticipation
- type ErrLuaType
- type File
- type Match
- func (m *Match) Create() error
- func (m *Match) ExecuteStatsUpdateScript() error
- func (m *Match) LoadParticipations() ([]ContestParticipation, error)
- func (m *Match) LoadRel() error
- func (m *Match) PartiesCount() (int, error)
- func (m *Match) Read() error
- func (m *Match) Representation() map[string]interface{}
- func (m *Match) SendToQueue(judge int32) error
- func (m *Match) ShortRepresentation() map[string]interface{}
- func (m *Match) Update() error
- type MatchParty
- type Submission
- func (s *Submission) Create() error
- func (s *Submission) IsVisibleTo(u User) bool
- func (s *Submission) LoadRel() error
- func (s *Submission) Read() error
- func (s *Submission) Representation() map[string]interface{}
- func (s *Submission) SendToQueue() error
- func (s *Submission) ShortRepresentation() map[string]interface{}
- func (s *Submission) Update() error
- type TableSchema
- type User
- func (u *User) AllContests() ([]map[string]interface{}, error)
- func (u *User) Create() error
- func (u *User) EmailCheck() bool
- func (u *User) LoadAvatar() (File, error)
- func (u *User) MatchesPagination(limit int, offset int) ([]map[string]interface{}, int, error)
- func (u *User) ReadByEmail() error
- func (u *User) ReadByHandle() error
- func (u *User) ReadById() error
- func (u *User) Representation() map[string]interface{}
- func (u *User) ShortRepresentation() map[string]interface{}
- func (u *User) Update() error
- func (u *User) UpdateAvatar() error
- func (u *User) UpdatePassword() error
- func (u *User) VerifyPassword(pw string) bool
Constants ¶
View Source
const ( ParticipationTypeModerator = iota ParticipationTypeContestant )
View Source
const ( MatchStatusPending = 0 MatchStatusRunning = 1 MatchStatusDone = 9 MatchStatusSystemError = -9 )
View Source
const ( SubmissionStatusPending = 0 SubmissionStatusCompiling = 1 SubmissionStatusAccepted = 9 SubmissionStatusCompilationFailed = -1 SubmissionStatusSystemError = -9 )
View Source
const ( UserPrivilegeNormal = iota UserPrivilegeOrganizer UserPrivilegeSuperuser )
Variables ¶
View Source
var ErrLua = errors.New("")
Functions ¶
func FakeDatabase ¶
func FakeDatabase()
func FakeMatches ¶
func FakeMatches()
func InitializeRedis ¶
func InitializeSchemata ¶
Types ¶
type Contest ¶
type Contest struct { Id int32 Title string Banner int32 Owner int32 StartTime int64 EndTime int64 Desc string Details string IsVisible bool IsRegOpen bool Judge int32 Script string Playback string Rel struct { Owner User Participations []ContestParticipation } }
func ContestReadAll ¶
func (*Contest) AllParticipations ¶
func (c *Contest) AllParticipations() ([]ContestParticipation, error)
func (*Contest) AllParticipationsRequiresDelegate ¶
func (c *Contest) AllParticipationsRequiresDelegate(d bool) ([]ContestParticipation, error)
func (*Contest) AllParticipationsWithDelegate ¶
func (c *Contest) AllParticipationsWithDelegate() ([]ContestParticipation, error)
func (*Contest) AppendScriptLog ¶
func (*Contest) ExecuteMatchScriptFunction ¶
func (*Contest) ExecuteMatchScriptOnManual ¶
func (*Contest) ExecuteMatchScriptOnSubmission ¶
func (*Contest) ExecuteMatchScriptOnTimer ¶
func (*Contest) HasStarted ¶
func (*Contest) IsVisibleTo ¶
func (*Contest) LoadBanner ¶
func (*Contest) LoadPlayback ¶
func (*Contest) PartParticipation ¶
func (c *Contest) PartParticipation(limit, offset int) ([]ContestParticipation, int, error)
func (*Contest) ParticipationOf ¶
func (*Contest) ReadModerators ¶
func (*Contest) ReadScriptLog ¶
func (*Contest) Representation ¶
func (*Contest) ResetLuaState ¶
func (c *Contest) ResetLuaState()
func (*Contest) ShortRepresentation ¶
func (*Contest) UpdateBanner ¶
func (*Contest) UpdateModerators ¶
type ContestParticipation ¶
type ContestParticipation struct { User int32 Contest int32 Type int8 Delegate int32 Rating int64 Performance string Rel struct { User User Contest Contest } }
func (*ContestParticipation) Create ¶
func (p *ContestParticipation) Create() error
func (*ContestParticipation) Read ¶
func (p *ContestParticipation) Read() error
func (*ContestParticipation) Representation ¶
func (p *ContestParticipation) Representation() map[string]interface{}
func (*ContestParticipation) Update ¶
func (p *ContestParticipation) Update() error
func (*ContestParticipation) UpdateStats ¶
func (p *ContestParticipation) UpdateStats() error
type ErrLuaType ¶
func (ErrLuaType) Error ¶
func (e ErrLuaType) Error() string
func (ErrLuaType) Unwrap ¶
func (e ErrLuaType) Unwrap() error
type Match ¶
type Match struct { Id int32 Contest int32 Status int8 Report string Rel struct { Contest Contest Parties []Submission } }
func ReadByContest ¶
func (*Match) ExecuteStatsUpdateScript ¶
func (*Match) LoadParticipations ¶
func (m *Match) LoadParticipations() ([]ContestParticipation, error)
func (*Match) PartiesCount ¶
func (*Match) Representation ¶
func (*Match) SendToQueue ¶
func (*Match) ShortRepresentation ¶
type MatchParty ¶
type MatchParty struct { Match int32 Index int32 Submission int32 Log string Rel struct { Match Match Submission Submission } }
func (*MatchParty) LoadLog ¶
func (p *MatchParty) LoadLog() error
func (*MatchParty) UpdateLog ¶
func (p *MatchParty) UpdateLog() error
type Submission ¶
type Submission struct { Id int32 User int32 Contest int32 CreatedAt int64 Status int8 Message string Language string Contents string Rel struct { User User Contest Contest } }
func (*Submission) Create ¶
func (s *Submission) Create() error
func (*Submission) LoadRel ¶
func (s *Submission) LoadRel() error
func (*Submission) Read ¶
func (s *Submission) Read() error
func (*Submission) Representation ¶
func (s *Submission) Representation() map[string]interface{}
func (*Submission) SendToQueue ¶
func (s *Submission) SendToQueue() error
func (*Submission) ShortRepresentation ¶
func (s *Submission) ShortRepresentation() map[string]interface{}
func (*Submission) Update ¶
func (s *Submission) Update() error
type TableSchema ¶
type TableSchema struct {
// contains filtered or unexported fields
}
type User ¶
type User struct { // Authorization Id int32 Handle string Email string Password string // Privilege Privilege int8 // Miscellaneous statistics JoinedAt int64 // Customized profile Nickname string Bio string Avatar int32 }
func UserSearchByHandle ¶
func (*User) AllContests ¶
func (*User) EmailCheck ¶
func (*User) LoadAvatar ¶
Returns extension, contents, error
func (*User) MatchesPagination ¶
func (*User) ReadByEmail ¶
func (*User) ReadByHandle ¶
func (*User) Representation ¶
func (*User) ShortRepresentation ¶
func (*User) UpdateAvatar ¶
func (*User) UpdatePassword ¶
func (*User) VerifyPassword ¶
Click to show internal directories.
Click to hide internal directories.