DriveLinked/pkg/serializer/response.go

27 lines
356 B
Go
Raw Normal View History

2022-04-03 12:30:50 +08:00
package serializer
import "net/http"
type Response struct {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
/*
自定义错误码
10000 用户操作
*/
const (
ErrNoUser = 10001
)
func Success(data interface{}) Response {
r := Response{
Code: http.StatusOK,
Msg: "",
Data: data,
}
return r
}