Documentation
¶
Index ¶
- Variables
- func AddCron(spec string, cmd func()) cron.EntryID
- func BindAndValidate(req interface{}, c echo.Context) (err error, ok bool)
- func CleanUpExpiredTokens() error
- func Contain(obj interface{}, target interface{}) bool
- func CreateBucket(name string) error
- func CreateEmptyGrades(problemSet *models.ProblemSet) error
- func FindProblem(id string, user *models.User) (*models.Problem, error)
- func FindSubmission(id uint, includeProblemSet bool) (*models.Submission, error)
- func FindTestCase(problemId string, testCaseIdStr string, user *models.User) (*models.TestCase, *models.Problem, error)
- func FindUser(id string) (*models.User, error)
- func GenerateInviteCode() (code string)
- func GetPresignedURL(bucket string, path string, fileName string) (string, error)
- func GetToken(tokenString string) (token models.Token, err error)
- func HashPassword(password string) (hashed string)
- func InitOrigin()
- func IsTokenExpired(token models.Token) bool
- func MustGetObject(c echo.Context, bucket string, path string) *minio.Object
- func MustPutObject(object *multipart.FileHeader, ctx context.Context, bucket string, path string)
- func Paginator(query *gorm.DB, limit, offset int, requestURL *url.URL, output interface{}) (total int, prevUrl, nextUrl *string, err error)
- func PanicIfDBError(db *gorm.DB, message string)
- func RandStr(n int) string
- func RefreshGrades(problemSet *models.ProblemSet) error
- func RemoveCron(entryId cron.EntryID)
- func RemoveCronByTime(entryID cron.EntryID, finalTime time.Time)
- func Sorter(query *gorm.DB, orderBy string, columns ...string) (*gorm.DB, error)
- func StartCron()
- func StopCron()
- func UpdateGrade(submission *models.Submission) error
- func VerifyPassword(password, hashed string) bool
- type HttpError
Constants ¶
This section is empty.
Variables ¶
View Source
var Origins []string
View Source
var RememberMeTimeout time.Duration
View Source
var SessionCount int
View Source
var SessionTimeout time.Duration
Functions ¶
func CleanUpExpiredTokens ¶
func CleanUpExpiredTokens() error
TODO: Use this function in timed tasks
func CreateBucket ¶
func CreateEmptyGrades ¶
func CreateEmptyGrades(problemSet *models.ProblemSet) error
func FindProblem ¶
This function checks if the user has permission to get problems which are not public. nil user pointer is regarded as admin(skip the permission judgement).
func FindSubmission ¶
func FindSubmission(id uint, includeProblemSet bool) (*models.Submission, error)
func FindTestCase ¶
func FindTestCase(problemId string, testCaseIdStr string, user *models.User) (*models.TestCase, *models.Problem, error)
This function checks if the user has permission to get problems which are not public. nil user pointer is regarded as admin(skip the permission judgement).
func GenerateInviteCode ¶
func GenerateInviteCode() (code string)
func GetPresignedURL ¶
func HashPassword ¶
func InitOrigin ¶
func InitOrigin()
func IsTokenExpired ¶
func MustPutObject ¶
func Paginator ¶
func Paginator(query *gorm.DB, limit, offset int, requestURL *url.URL, output interface{}) (total int, prevUrl, nextUrl *string, err error)
Paginator 分页,查询
func PanicIfDBError ¶
func RefreshGrades ¶
func RefreshGrades(problemSet *models.ProblemSet) error
func RemoveCron ¶
func RemoveCronByTime ¶
todo: Sleep这个主意由Copilot自动生成,本来想尝试time.timer,所以待验证是否可行 到期自动删除Cron任务
func UpdateGrade ¶
func UpdateGrade(submission *models.Submission) error
func VerifyPassword ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.