Documentation ¶
Index ¶
- Constants
- Variables
- func OutputError(c *gin.Context) func(error ErrorStruct)
- func OutputErrorDetail(c *gin.Context) func(data interface{}, error ErrorStruct)
- func OutputErrorDetailWithHttpState(c *gin.Context) func(data interface{}, error ErrorStruct, httpState int)
- func OutputErrorWithHttpState(c *gin.Context) func(error ErrorStruct, httpState int)
- func OutputFail(c *gin.Context)
- func OutputFailDetail(c *gin.Context) func(data interface{}, message string)
- func OutputFailMsg(c *gin.Context) func(message string)
- func OutputFailedPermission(c *gin.Context) func(data interface{}, message string)
- func OutputFailedSignature(c *gin.Context) func(data interface{}, message string)
- func OutputOk(c *gin.Context)
- func OutputOkData(c *gin.Context) func(data interface{})
- func OutputOkDetail(c *gin.Context) func(data interface{}, message string)
- func OutputOkMsg(c *gin.Context) func(message string)
- type ErrorResult
- type ErrorStruct
- type JSONResult
- type PageResult
- type ResultFunc
Constants ¶
View Source
const ( HTTP_STATE_200 = 200 HTTP_STATE_401 = 401 HTTP_STATE_403 = 403 )
Variables ¶
View Source
var ( SUCCESS = ErrorStruct{0, "Successful", []interface{}{}} ERROR = ErrorStruct{7, "Failed", []interface{}{}} SYSTEM_ERROR = ErrorStruct{100000, "系统错误", []interface{}{}} PARAMS_ERROR = ErrorStruct{100001, "参数错误", []interface{}{}} ACCOUNT_PASSWORD_ERROR = ErrorStruct{100020, "账号密码错误", []interface{}{}} )
View Source
var ResultPool *sync.Pool
Functions ¶
func OutputError ¶
func OutputError(c *gin.Context) func(error ErrorStruct)
func OutputErrorDetail ¶
func OutputErrorDetail(c *gin.Context) func(data interface{}, error ErrorStruct)
func OutputErrorDetailWithHttpState ¶
func OutputErrorDetailWithHttpState(c *gin.Context) func(data interface{}, error ErrorStruct, httpState int)
func OutputErrorWithHttpState ¶
func OutputErrorWithHttpState(c *gin.Context) func(error ErrorStruct, httpState int)
func OutputFail ¶
func OutputFailDetail ¶
func OutputFailMsg ¶
func OutputFailedPermission ¶
func OutputFailedSignature ¶
func OutputOkData ¶
func OutputOkDetail ¶
func OutputOkMsg ¶
Types ¶
type ErrorResult ¶
type ErrorResult struct {
// contains filtered or unexported fields
}
func Result ¶
func Result(errs ...interface{}) *ErrorResult
func (*ErrorResult) Unwrap ¶
func (r *ErrorResult) Unwrap(errType ...ErrorStruct) interface{}
type ErrorStruct ¶
type JSONResult ¶
type JSONResult struct { Message string `json:"msg"` Code int `json:"code"` Data interface{} `json:"data"` }
func NewJSONResult ¶
func NewJSONResult(message string, code int, result interface{}) *JSONResult
type PageResult ¶
type ResultFunc ¶
func Output ¶
func Output(c *gin.Context) ResultFunc
Click to show internal directories.
Click to hide internal directories.