Documentation ¶
Index ¶
- Variables
- func BindJSON(c *gin.Context, r interface{}) (err error)
- func GetConfig(c *gin.Context) *cfg.Config
- func GetContest(c *gin.Context) *cpt.Contest
- func GetDB(c *gin.Context) *gorm.DB
- func GetFlag(c *gin.Context) *cpt.Flag
- func GetHint(c *gin.Context) *cpt.Hint
- func GetNotification(c *gin.Context) *cpt.ContestNotification
- func GetProblem(c *gin.Context) *cpt.Problem
- func GetRedis(c *gin.Context) *redis.Pool
- func GetResource(c *gin.Context) *cpt.Resource
- func GetSession(c *gin.Context) *cpt.Session
- func GetTeam(c *gin.Context) *cpt.Team
- func GetUser(c *gin.Context) *cpt.User
- func Pack(c *gin.Context, err *error, response ResponseInterface)
- type Response
- type ResponseInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RespSuccess = Response{0, "success", nil, http.StatusOK} RespBadRequest = Response{1, "bad request", nil, http.StatusBadRequest} RespNotFound = Response{2, "not found", nil, http.StatusNotFound} RespLoggedIn = Response{10, "have been logged in", nil, http.StatusBadRequest} RespNotLoggedIn = Response{11, "haven't been logged in", nil, http.StatusBadRequest} RespDuplicatedName = Response{12, "duplicated name", nil, http.StatusBadRequest} RespDuplicatedUsername = Response{100, "duplicated username", nil, http.StatusBadRequest} RespDuplicatedEmail = Response{101, "duplicated email", nil, http.StatusBadRequest} RespValidationFailed = Response{102, "validate failed", nil, http.StatusBadRequest} RespWrongUsernameOrPassword = Response{201, "wrong username or password", nil, http.StatusNotFound} RespDuplicatedAlias = Response{300, "duplicated alias", nil, http.StatusBadRequest} RespNotEnoughPoints = Response{400, "not enough points", nil, http.StatusBadRequest} RespMemberParticipated = Response{500, "some of the members you selected have participated the contest in another team", nil, http.StatusBadRequest} RespTeamParticipated = Response{501, "your team has participated the contest", nil, http.StatusBadRequest} RespNotMemberOfTeam = Response{502, "some of the members you selected are not a part of your team", nil, http.StatusBadRequest} RespNotAdminOfTeam = Response{503, "the user is not the team's admin", nil, http.StatusBadRequest} RespProcessed = Response{600, "the resource has been processed", nil, http.StatusBadRequest} RespTimeout = Response{601, "the resource has expired", nil, http.StatusBadRequest} RespAlreadyJoinedInTeam = Response{602, "the user has joined the team", nil, http.StatusBadRequest} RespInvalidInvitationToken = Response{603, "invalid invitation token", nil, http.StatusBadRequest} RespNotInvited = Response{604, "the user has not been invited", nil, http.StatusBadRequest} RespAlreadyInvited = Response{605, "the user has been invited", nil, http.StatusBadRequest} RespNoSuchApplication = Response{606, "no such application", nil, http.StatusBadRequest} RespAlreadyApplied = Response{607, "the user has applied", nil, http.StatusBadRequest} RespContestPending = Response{700, "the contest is pending", nil, http.StatusBadRequest} RespContestStarted = Response{701, "the contest is started", nil, http.StatusBadRequest} RespContestEnded = Response{702, "the contest is ended", nil, http.StatusBadRequest} RespInvalidCaptchaFor = Response{800, "invalid captcha for", nil, http.StatusBadRequest} RespServerError = Response{-1, "internal server error", nil, http.StatusInternalServerError} RespSessionExpired = Response{-2, "session is expired", nil, http.StatusUnauthorized} RespPermissionDenied = Response{-3, "permission denied", nil, http.StatusUnauthorized} RespPartlyFailed = Response{-4, "request partly failed", nil, http.StatusMultiStatus} RespWriteConfigFile = Response{-5, "failed to write config file", nil, http.StatusInternalServerError} RespCoolDown = Response{-6, "cooling down", nil, http.StatusBadRequest} RespInvalidCaptcha = Response{-7, "invalid captcha", nil, http.StatusBadRequest} RespNotInWhitelist = Response{-8, "not in whitelist", nil, http.StatusForbidden} RespDangerousOperation = Response{-9, "dangerous operation", nil, http.StatusForbidden} RespFailedToSendEmail = Response{-10, "failed to send email", nil, http.StatusInternalServerError} )
Universal responses definition
Functions ¶
func GetNotification ¶
func GetNotification(c *gin.Context) *cpt.ContestNotification
Types ¶
type Response ¶
type Response struct { Status int `json:"status"` Message string `json:"message"` Validate *map[string][]string `json:"validate,omitempty"` // contains filtered or unexported fields }
func (*Response) GetHttpStatus ¶
type ResponseInterface ¶
Click to show internal directories.
Click to hide internal directories.