responseBean.go 471 B

123456789101112131415161718192021
  1. package result
  2. type ResponseSuccessBean struct {
  3. Code uint32 `json:"code"`
  4. Msg string `json:"msg"`
  5. Data interface{} `json:"data"`
  6. }
  7. type NullJson struct{}
  8. func Success(data interface{}) *ResponseSuccessBean {
  9. return &ResponseSuccessBean{200, "OK", data}
  10. }
  11. type ResponseErrorBean struct {
  12. Code uint32 `json:"code"`
  13. Msg string `json:"msg"`
  14. }
  15. func Error(errCode uint32, errMsg string) *ResponseErrorBean {
  16. return &ResponseErrorBean{errCode, errMsg}
  17. }