-
Notifications
You must be signed in to change notification settings - Fork 9
/
LogisticsInfo.go
37 lines (32 loc) · 985 Bytes
/
LogisticsInfo.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
package nlife
import (
"sync"
)
// LogisticsInfo 结构体
type LogisticsInfo struct {
// 货流详细信息
LogisticsInfoDetails []LogisticsInfoDetail `json:"logistics_info_details,omitempty" xml:"logistics_info_details>logistics_info_detail,omitempty"`
// 收货人
Receiver string `json:"receiver,omitempty" xml:"receiver,omitempty"`
// 收货地址
Address string `json:"address,omitempty" xml:"address,omitempty"`
// 收货人联系电话
PhoneNo string `json:"phone_no,omitempty" xml:"phone_no,omitempty"`
}
var poolLogisticsInfo = sync.Pool{
New: func() any {
return new(LogisticsInfo)
},
}
// GetLogisticsInfo() 从对象池中获取LogisticsInfo
func GetLogisticsInfo() *LogisticsInfo {
return poolLogisticsInfo.Get().(*LogisticsInfo)
}
// ReleaseLogisticsInfo 释放LogisticsInfo
func ReleaseLogisticsInfo(v *LogisticsInfo) {
v.LogisticsInfoDetails = v.LogisticsInfoDetails[:0]
v.Receiver = ""
v.Address = ""
v.PhoneNo = ""
poolLogisticsInfo.Put(v)
}