1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package response
- // 数据集
- type Response struct {
- RequestId string `protobuf:"bytes,1,opt,name=requestId,proto3" json:"requestId,omitempty"`
- Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
- Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"`
- Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"`
- }
- type response struct {
- Response
- Data interface{} `json:"data"`
- }
- type Page struct {
- Count int `json:"count"` //总数
- Page int `json:"page"` //页码
- PageSize int `json:"pageSize"` //页条数
- }
- type page struct {
- Count int `json:"count"` //总数
- Page int `json:"page"` //页码
- PageSize int `json:"pageSize"` //页条数
- List interface{} `json:"list"`
- }
- func (e *response) SetData(data interface{}) {
- e.Data = data
- }
- func (e response) Clone() Responses {
- return &e
- }
- func (e *response) SetTraceID(id string) {
- e.RequestId = id
- }
- func (e *response) SetMsg(s string) {
- e.Msg = s
- }
- func (e *response) SetCode(code int32) {
- e.Code = code
- }
- func (e *response) SetSuccess(success bool) {
- if !success {
- e.Status = "error"
- }
- }
|