File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed
Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,9 @@ import (
2323)
2424
2525type CommonResp struct {
26- Code string `json:"code"`
27- Msg string `json:"msg "`
28- Data any `json:"data"`
26+ Code string `json:"code"`
27+ Message string `json:"message "`
28+ Data any `json:"data"`
2929}
3030
3131func (r * CommonResp ) WithCode (code string ) * CommonResp {
@@ -34,7 +34,7 @@ func (r *CommonResp) WithCode(code string) *CommonResp {
3434}
3535
3636func (r * CommonResp ) WithMsg (msg string ) * CommonResp {
37- r .Msg = msg
37+ r .Message = msg
3838 return r
3939}
4040
@@ -45,26 +45,26 @@ func (r *CommonResp) WithData(data any) *CommonResp {
4545
4646func NewSuccessResp (data any ) * CommonResp {
4747 return & CommonResp {
48- Code : "Success" ,
49- Msg : "success" ,
50- Data : data ,
48+ Code : "Success" ,
49+ Message : "success" ,
50+ Data : data ,
5151 }
5252}
5353
5454// NewErrorResp TODO replace with NewBizErrorResp
5555func NewErrorResp (msg string ) * CommonResp {
5656 return & CommonResp {
57- Code : string (bizerror .UnknownError ),
58- Msg : msg ,
59- Data : nil ,
57+ Code : string (bizerror .UnknownError ),
58+ Message : msg ,
59+ Data : nil ,
6060 }
6161}
6262
6363func NewBizErrorResp (err bizerror.Error ) * CommonResp {
6464 return & CommonResp {
65- Code : string (err .Code ()),
66- Msg : err .Message (),
67- Data : nil ,
65+ Code : string (err .Code ()),
66+ Message : err .Message (),
67+ Data : nil ,
6868 }
6969}
7070
You can’t perform that action at this time.
0 commit comments