Documentation ¶
Index ¶
- Variables
- func FetchHttpStatus(code string) int
- type CodeWrapper
- type WebResult
- func BadRequest(format string, v ...interface{}) *WebResult
- func BadRequestI18n(request *http.Request, item *i18n.Item, v ...interface{}) *WebResult
- func ConstWebResult(codeWrapper *CodeWrapper) *WebResult
- func CustomWebResult(codeWrapper *CodeWrapper, description string) *WebResult
- func CustomWebResultI18n(request *http.Request, codeWrapper *CodeWrapper, item *i18n.Item, ...) *WebResult
- func NotFound(format string, v ...interface{}) *WebResult
- func Server(format string, v ...interface{}) *WebResult
- func Unauthorized(format string, v ...interface{}) *WebResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OK = &CodeWrapper{Code: "OK", HttpStatus: http.StatusOK, Description: "ok"} BAD_REQUEST = &CodeWrapper{Code: "BAD_REQUEST", HttpStatus: http.StatusBadRequest, Description: "bad request"} NEED_SHARE_CODE = &CodeWrapper{Code: "NEED_SHARE_CODE", HttpStatus: http.StatusUnauthorized, Description: "share code required"} SHARE_CODE_ERROR = &CodeWrapper{Code: "SHARE_CODE_ERROR", HttpStatus: http.StatusUnauthorized, Description: "share code error"} LOGIN = &CodeWrapper{Code: "LOGIN", HttpStatus: http.StatusUnauthorized, Description: "not login"} USER_DISABLED = &CodeWrapper{Code: "USER_DISABLED", HttpStatus: http.StatusForbidden, Description: "user disabled"} UNAUTHORIZED = &CodeWrapper{Code: "UNAUTHORIZED", HttpStatus: http.StatusUnauthorized, Description: "unauthorized"} NOT_FOUND = &CodeWrapper{Code: "NOT_FOUND", HttpStatus: http.StatusNotFound, Description: "404 not found"} RANGE_NOT_SATISFIABLE = &CodeWrapper{Code: "RANGE_NOT_SATISFIABLE", HttpStatus: http.StatusRequestedRangeNotSatisfiable, Description: "range not satisfiable"} NOT_INSTALLED = &CodeWrapper{Code: "NOT_INSTALLED", HttpStatus: http.StatusInternalServerError, Description: "application not installed"} SERVER = &CodeWrapper{Code: "SERVER", HttpStatus: http.StatusInternalServerError, Description: "server error"} UNKNOWN = &CodeWrapper{Code: "UNKNOWN", HttpStatus: http.StatusInternalServerError, Description: "server unknow error"} )
View Source
var ( DB_ERROR_DUPLICATE_KEY = "Error 1062: Duplicate entry" DB_ERROR_NOT_FOUND = "record not found" DB_TOO_MANY_CONNECTIONS = "Error 1040: Too many connections" DB_BAD_CONNECTION = "driver: bad connection" )
db error.
Functions ¶
func FetchHttpStatus ¶
Types ¶
type CodeWrapper ¶
type WebResult ¶
type WebResult struct { Code string `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
func BadRequest ¶
func BadRequestI18n ¶
func ConstWebResult ¶
func ConstWebResult(codeWrapper *CodeWrapper) *WebResult
func CustomWebResult ¶
func CustomWebResult(codeWrapper *CodeWrapper, description string) *WebResult
func CustomWebResultI18n ¶
func Unauthorized ¶
Click to show internal directories.
Click to hide internal directories.