add: some user api and all api desc
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package responses
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type ErrorResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func (e *ErrorResponse) Error() string {
|
||||
marshal, err := json.Marshal(e)
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
return string(marshal)
|
||||
}
|
||||
|
||||
func NewErrorResp(code int, msg error) *ErrorResponse {
|
||||
return &ErrorResponse{
|
||||
Code: code,
|
||||
Msg: msg.Error(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user