-
Notifications
You must be signed in to change notification settings - Fork 9
/
ResultBase.go
43 lines (38 loc) · 1019 Bytes
/
ResultBase.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
41
42
43
package tmallsc
import (
"sync"
)
// ResultBase 结构体
type ResultBase struct {
// gmtModified
GmtModified string `json:"gmt_modified,omitempty" xml:"gmt_modified,omitempty"`
// gmtCreate
GmtCreate string `json:"gmt_create,omitempty" xml:"gmt_create,omitempty"`
// value
Value string `json:"value,omitempty" xml:"value,omitempty"`
// errorMsg
ErrorMsg string `json:"error_msg,omitempty" xml:"error_msg,omitempty"`
// errorCode
ErrorCode int64 `json:"error_code,omitempty" xml:"error_code,omitempty"`
// success
Success bool `json:"success,omitempty" xml:"success,omitempty"`
}
var poolResultBase = sync.Pool{
New: func() any {
return new(ResultBase)
},
}
// GetResultBase() 从对象池中获取ResultBase
func GetResultBase() *ResultBase {
return poolResultBase.Get().(*ResultBase)
}
// ReleaseResultBase 释放ResultBase
func ReleaseResultBase(v *ResultBase) {
v.GmtModified = ""
v.GmtCreate = ""
v.Value = ""
v.ErrorMsg = ""
v.ErrorCode = 0
v.Success = false
poolResultBase.Put(v)
}