backend/app/brahma/api/murder/internal/handler/dto.go

37 lines
641 B
Go
Raw Permalink Normal View History

2022-01-12 14:34:31 +08:00
package handler
const (
ResponseCodeSuccess = 0
ResponseCodeFail = -1
ResponseSuccess = "success"
ResponseFail = "fail"
)
type (
Response struct {
Code int `json:"code"`
Message string `json:"message"`
Data *Data `json:"data,omitempty"`
}
Data struct {
Elements interface{} `json:"elements"`
Total int64 `json:"total"`
}
)
func fail(data *Data) Response {
return Response{
Code: ResponseCodeFail,
Message: ResponseFail,
Data: data,
}
}
func success(data *Data) Response {
return Response{
Code: ResponseCodeSuccess,
Message: ResponseSuccess,
Data: data,
}
}