You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
475 B

package model
import (
"encoding/json"
"go-common/library/ecode"
)
// Response .
type Response struct {
Code int `json:"code"`
Message string `json:"message"`
Data map[string]interface{} `json:"data"`
}
// Message .
func Message(raw map[string]interface{}, e error) (bs []byte) {
res := &Response{
Code: ecode.Cause(e).Code(),
Message: ecode.Cause(e).Message(),
Data: raw,
}
bs, _ = json.Marshal(res)
return
}