-
Notifications
You must be signed in to change notification settings - Fork 12
/
AddressDto.go
40 lines (35 loc) · 949 Bytes
/
AddressDto.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 cainiaolocker
import (
"sync"
)
// AddressDto 结构体
type AddressDto struct {
// 城市,长度小于20
City string `json:"city,omitempty" xml:"city,omitempty"`
// 详细地址,长度小于256
Detail string `json:"detail,omitempty" xml:"detail,omitempty"`
// 区,长度小于20
District string `json:"district,omitempty" xml:"district,omitempty"`
// 省,长度小于20
Province string `json:"province,omitempty" xml:"province,omitempty"`
// 街道,长度小于30
Town string `json:"town,omitempty" xml:"town,omitempty"`
}
var poolAddressDto = sync.Pool{
New: func() any {
return new(AddressDto)
},
}
// GetAddressDto() 从对象池中获取AddressDto
func GetAddressDto() *AddressDto {
return poolAddressDto.Get().(*AddressDto)
}
// ReleaseAddressDto 释放AddressDto
func ReleaseAddressDto(v *AddressDto) {
v.City = ""
v.Detail = ""
v.District = ""
v.Province = ""
v.Town = ""
poolAddressDto.Put(v)
}