goProject/trunk/framework/mqMgr/model/common_response.go

29 lines
623 B
Go
Raw Normal View History

2025-01-06 16:01:02 +08:00
package model
// CommonResponse 公共请求结果对象
type CommonResponse struct {
// 错误码
Code ResultStatus `json:"code"`
// 错误提示信息
Message string `json:"message"`
// 服务器生成的请求Id
RequestId string `json:"requestId"`
}
// IsSuccess 请求结果是否成功
func (this *CommonResponse) IsSuccess() bool {
return this.Code == Success
}
// IsFailure 请求结果是否失败
func (this *CommonResponse) IsFailure() bool {
return this.Code != Success
}
// HasMessage 请求结果是否有信息
func (this *CommonResponse) HaveNoMessage() bool {
return this.Code == NoMessage
}