/
ResponseResult.go
40 lines (35 loc) · 1008 Bytes
/
ResponseResult.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package alihealth2
import (
"sync"
)
// ResponseResult 结构体
type ResponseResult struct {
// 错误码
ErrorCode string `json:"error_code,omitempty" xml:"error_code,omitempty"`
// 错误信息
ErrorMsg string `json:"error_msg,omitempty" xml:"error_msg,omitempty"`
// 订单详情对象
Result *TopOrderDetailDto `json:"result,omitempty" xml:"result,omitempty"`
// 是否成功
Success bool `json:"success,omitempty" xml:"success,omitempty"`
// 是否成功
Issuccess bool `json:"issuccess,omitempty" xml:"issuccess,omitempty"`
}
var poolResponseResult = sync.Pool{
New: func() any {
return new(ResponseResult)
},
}
// GetResponseResult() 从对象池中获取ResponseResult
func GetResponseResult() *ResponseResult {
return poolResponseResult.Get().(*ResponseResult)
}
// ReleaseResponseResult 释放ResponseResult
func ReleaseResponseResult(v *ResponseResult) {
v.ErrorCode = ""
v.ErrorMsg = ""
v.Result = nil
v.Success = false
v.Issuccess = false
poolResponseResult.Put(v)
}