Documentation
¶
Overview ¶
自定义响应 辅助方法层
Index ¶
- Constants
- func ErrorToErrorCode(err error) *MyError
- type Response
- func (this *Response) DealErr(err error) (errorTrace []string)
- func (this *Response) Error(ctx *fiber.Ctx, err error) error
- func (this *Response) JsonDealErr(err error) string
- func (this *Response) Output(ctx *fiber.Ctx, data interface{}) error
- func (this *Response) ReturnValOrNull(value, empty interface{}) interface{}
- func (this *Response) SliceReturnValOrNull(value []string, empty interface{}) interface{}
- func (this *Response) Success(ctx *fiber.Ctx, msg string, data interface{}) error
Constants ¶
View Source
const ( SUCCESS = 0 ERROR = 500 )
View Source
const ( SearchSuccess = "SearchSuccess" DeleteSuccess = "DeleteSuccess" OperateSuccess = "OperateSuccess" LogoutSuccess = "LogoutSuccess" LinkSuccess = "LinkSuccess" LoginSuccess = "LoginSuccess" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Response ¶
type Response struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
自定义响应方法
func (*Response) JsonDealErr ¶
func (*Response) ReturnValOrNull ¶
func (this *Response) ReturnValOrNull(value, empty interface{}) interface{}
func (*Response) SliceReturnValOrNull ¶
Click to show internal directories.
Click to hide internal directories.