Documentation
¶
Index ¶
- type Class
- type ClassDetail
- type Grade
- type Permission
- type Problem
- type ProblemForAdmin
- type ProblemSet
- type ProblemSetDetail
- type ProblemSetSummary
- type ProblemSetWithGrades
- type ProblemSummary
- type ProblemSummaryForAdmin
- type Role
- type Run
- type Submission
- type SubmissionDetail
- type Tag
- type TestCase
- type TestCaseForAdmin
- type User
- type UserForAdmin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Class ¶
type Class struct {
ID uint `json:"id"`
Name string `json:"name"`
CourseName string `json:"course_name"`
Description string `json:"description"`
Managers []User `json:"managers"`
Students []User `json:"students"`
ProblemSets []ProblemSetSummary `json:"problem_sets"`
}
func GetClassSlice ¶
type ClassDetail ¶
type ClassDetail struct {
ID uint `json:"id"`
Name string `json:"name"`
CourseName string `json:"course_name"`
Description string `json:"description"`
InviteCode string `json:"invite_code"`
Managers []User `json:"managers"`
Students []User `json:"students"`
ProblemSets []ProblemSetSummary `json:"problem_sets"`
}
func GetClassDetail ¶
func GetClassDetail(class *models.Class) *ClassDetail
type Grade ¶
type Grade struct {
ID uint `json:"id"`
UserID uint `json:"user_id"`
User *User `json:"user"`
ProblemSetID uint `json:"problem_set_id"`
Detail string `json:"detail"`
Total uint `json:"total"`
}
func GetGradeSlice ¶
type Permission ¶
func GetPermission ¶
func GetPermission(perm *models.Permission) *Permission
type Problem ¶
type Problem struct {
ID uint `json:"id"`
Name string `sql:"index" json:"name"`
Description string `json:"description"`
AttachmentFileName string `json:"attachment_file_name"`
MemoryLimit uint64 `json:"memory_limit"` // Byte
TimeLimit uint `json:"time_limit"` // ms
LanguageAllowed []string `json:"language_allowed"`
CompareScriptName string `json:"compare_script_name"`
TestCases []TestCase `json:"test_cases"`
Tags []Tag `json:"tags"`
}
func GetProblem ¶
func GetProblemSlice ¶
type ProblemForAdmin ¶
type ProblemForAdmin struct {
ID uint `json:"id"`
Name string `sql:"index" json:"name"`
Description string `json:"description"`
AttachmentFileName string `json:"attachment_file_name"`
Public bool `json:"public"`
Privacy bool `json:"privacy"`
MemoryLimit uint64 `json:"memory_limit"` // Byte
TimeLimit uint `json:"time_limit"` // ms
LanguageAllowed []string `json:"language_allowed"`
BuildArg string `json:"build_arg"` // E.g. O2=false
CompareScriptName string `json:"compare_script_name"`
TestCases []TestCaseForAdmin `json:"test_cases"`
Tags []Tag `json:"tags"`
}
func GetProblemForAdmin ¶
func GetProblemForAdmin(problem *models.Problem) *ProblemForAdmin
func GetProblemForAdminSlice ¶
func GetProblemForAdminSlice(problems []*models.Problem) (profiles []ProblemForAdmin)
type ProblemSet ¶
type ProblemSet struct {
ID uint `json:"id"`
ClassID uint `json:"class_id"`
Name string `json:"name"`
Description string `json:"description"`
Problems []ProblemSummary `json:"problems"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
func GetProblemSet ¶
func GetProblemSet(problemSet *models.ProblemSet) *ProblemSet
func GetProblemSetSlice ¶
func GetProblemSetSlice(problemSetSlice []*models.ProblemSet) (ps []ProblemSet)
type ProblemSetDetail ¶
type ProblemSetDetail struct {
ID uint `json:"id"`
ClassID uint `json:"class_id"`
Name string `json:"name"`
Description string `json:"description"`
Problems []ProblemSummary `json:"problems"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
func GetProblemSetDetail ¶
func GetProblemSetDetail(problemSet *models.ProblemSet) *ProblemSetDetail
type ProblemSetSummary ¶
type ProblemSetSummary struct {
ID uint `json:"id"`
ClassID uint `json:"class_id"`
Name string `json:"name"`
Description string `json:"description"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
func GetProblemSetSummary ¶
func GetProblemSetSummary(problemSet *models.ProblemSet) *ProblemSetSummary
func GetProblemSetSummarySlice ¶
func GetProblemSetSummarySlice(problemSetSlice []*models.ProblemSet) (ps []ProblemSetSummary)
type ProblemSetWithGrades ¶
type ProblemSetWithGrades struct {
ID uint `json:"id"`
ClassID uint `json:"class_id"`
Name string `json:"name"`
Description string `json:"description"`
Problems []ProblemSummary `json:"problems"`
Grades []Grade `json:"grades"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
func GetProblemSetWithGrades ¶
func GetProblemSetWithGrades(problemSet *models.ProblemSet) *ProblemSetWithGrades
type ProblemSummary ¶
type ProblemSummary struct {
ID uint `json:"id"`
Name string `sql:"index" json:"name"`
AttachmentFileName string `json:"attachment_file_name"`
Passed bool `json:"passed"`
MemoryLimit uint64 `json:"memory_limit"` // Byte
TimeLimit uint `json:"time_limit"` // ms
LanguageAllowed []string `json:"language_allowed"`
CompareScriptName string `json:"compare_script_name"`
Tags []Tag `json:"tags"`
}
func GetProblemSummary ¶
func GetProblemSummary(problem *models.Problem, passed sql.NullBool) *ProblemSummary
func GetProblemSummarySlice ¶
func GetProblemSummarySlice(problems []*models.Problem, passed []sql.NullBool) (summaries []ProblemSummary)
type ProblemSummaryForAdmin ¶
type ProblemSummaryForAdmin struct {
ID uint `json:"id"`
Name string `sql:"index" json:"name"`
AttachmentFileName string `json:"attachment_file_name"`
Public bool `json:"public"`
Privacy bool `json:"privacy"`
Passed bool `json:"passed"`
MemoryLimit uint64 `json:"memory_limit"` // Byte
TimeLimit uint `json:"time_limit"` // ms
LanguageAllowed []string `json:"language_allowed"`
BuildArg string `json:"build_arg"` // E.g. O2=false
CompareScriptName string `json:"compare_script_name"`
Tags []Tag `json:"tags"`
}
func GetProblemSummaryForAdmin ¶
func GetProblemSummaryForAdmin(problem *models.Problem, passed sql.NullBool) *ProblemSummaryForAdmin
func GetProblemSummaryForAdminSlice ¶
func GetProblemSummaryForAdminSlice(problems []*models.Problem, passed []sql.NullBool) (summaries []ProblemSummaryForAdmin)
type Role ¶
type Role struct {
ID uint `json:"id"`
Name string `json:"name"`
Target *string `json:"target"`
Permissions []Permission `json:"permissions"`
TargetID uint `json:"target_id"`
}
func GetRole ¶
func GetRole(role *models.UserHasRole) *Role
func GetRoleSlice ¶
func GetRoleSlice(roles []models.UserHasRole) (profiles []Role)
type Run ¶
type Run struct {
ID uint `json:"id"`
UserID uint `json:"user_id"`
ProblemID uint `json:"problem_id"`
ProblemSetID uint `json:"problem_set_id"`
TestCaseID uint `json:"test_case_id"`
Sample bool `json:"sample"`
SubmissionID uint `json:"submission_id"`
Priority uint8 `json:"priority"`
Judged bool `json:"judged"`
Status string `json:"status"` // AC WA TLE MLE OLE
MemoryUsed uint `json:"memory_used"` // Byte
TimeUsed uint `json:"time_used"` // ms
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func GetRunSlice ¶
type Submission ¶
type Submission struct {
ID uint `json:"id"`
UserID uint `json:"user_id"`
User *User `json:"user"`
ProblemID uint `json:"problem_id"`
ProblemName string `json:"problem_name"`
ProblemSetID uint `json:"problem_set_id"` // 0 means not in problem set
Language string `json:"language"`
Judged bool `json:"judged"`
Score uint `json:"score"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func GetSubmission ¶
func GetSubmission(submission *models.Submission) *Submission
func GetSubmissionSlice ¶
func GetSubmissionSlice(submissions []models.Submission) []Submission
type SubmissionDetail ¶
type SubmissionDetail struct {
ID uint `json:"id"`
UserID uint `json:"user_id"`
User *User `json:"user"`
ProblemID uint `json:"problem_id"`
ProblemName string `json:"problem_name"`
ProblemSetID uint `json:"problem_set_id"`
Language string `json:"language"`
FileName string `json:"file_name"`
Priority uint8 `json:"priority"`
Judged bool `json:"judged"`
Score uint `json:"score"`
Status string `json:"status"`
Runs []Run `json:"runs"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func GetSubmissionDetail ¶
func GetSubmissionDetail(submission *models.Submission) *SubmissionDetail
func GetSubmissionDetailSlice ¶
func GetSubmissionDetailSlice(submissions []models.Submission) []SubmissionDetail
type TestCase ¶
type TestCase struct {
ID uint `json:"id"`
ProblemID uint `sql:"index" json:"problem_id"`
Score uint `json:"score"` // 0 for 平均分配
Sample bool `json:"sample"`
}
func GetTestCase ¶
type TestCaseForAdmin ¶
type TestCaseForAdmin struct {
ID uint `json:"id"`
ProblemID uint `sql:"index" json:"problem_id"`
Score uint `json:"score"` // 0 for 平均分配
Sample bool `json:"sample"`
InputFileName string `json:"input_file_name"`
OutputFileName string `json:"output_file_name"`
}
func GetTestCaseForAdmin ¶
func GetTestCaseForAdmin(testCase *models.TestCase) *TestCaseForAdmin
type User ¶
type User struct {
ID uint `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Email string `json:"email"`
}
func GetUserSlice ¶
type UserForAdmin ¶
type UserForAdmin struct {
// ID is the user's id.
ID uint `json:"id"`
// Username is the user's username, usually the student ID if used in schools.
Username string `json:"username"`
// Nickname is the user's nickname, usually the student name if used in schools.
Nickname string `json:"nickname"`
// Email is the user's email.
Email string `json:"email"`
// Role is the user's role, and is used to obtain the permissions of a user.
Roles []Role `json:"roles"`
}
@description UserForAdmin is a user with additional, credential data, only accessible by people has permission, @description e.g. admin can access to all user's credential data, and a user can access to his/her credential data.
func GetUserForAdmin ¶
func GetUserForAdmin(user *models.User) *UserForAdmin
Click to show internal directories.
Click to hide internal directories.