Documentation ¶
Index ¶
- func ApiErrorResponse(gCtx *gin.Context, status int, code ApiErrorCode, err error)
- func BasicAuthHandler(h http.Handler, users []config.OverwriteUser) http.Handler
- func ErrorResponse(gCtx *gin.Context, err error)
- func HttpStatusResponse(gCtx *gin.Context, status int, err error)
- func JsonResponse(gCtx *gin.Context, status int, data interface{})
- func MetricMiddleware(handlerID string, handler http.Handler) http.Handler
- type ApiErrorCode
- type Error
- type Response
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiErrorResponse ¶
func ApiErrorResponse(gCtx *gin.Context, status int, code ApiErrorCode, err error)
func BasicAuthHandler ¶
func ErrorResponse ¶
func JsonResponse ¶
Types ¶
type ApiErrorCode ¶
type ApiErrorCode string
const ( ApiArgsError ApiErrorCode = "ArgsError" ApiNoAccess ApiErrorCode = "NoAccess" ApiNoPermits ApiErrorCode = "NoPermits" ApiNotFoundError ApiErrorCode = "NotFound" ApiNotGroupError ApiErrorCode = "NotGroup" ApiIsGroupError ApiErrorCode = "IsGroup" ApiNotEmptyError ApiErrorCode = "NotEmpty" ApiEntryExisted ApiErrorCode = "EntryExisted" ApiInternalError ApiErrorCode = "InternalError" )
func Error2ApiErrorCode ¶
func Error2ApiErrorCode(err error) (int, ApiErrorCode)
type Error ¶
type Error struct { Code ApiErrorCode `json:"code"` Message string `json:"message"` }
Click to show internal directories.
Click to hide internal directories.