-
Notifications
You must be signed in to change notification settings - Fork 9
/
AttributeDto.go
37 lines (32 loc) · 1.23 KB
/
AttributeDto.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 aesolution
import (
"sync"
)
// AttributeDto 结构体
type AttributeDto struct {
// merchant's attribute name
AttributeName string `json:"attribute_name,omitempty" xml:"attribute_name,omitempty"`
// merchant's attribute value
AttributeValue string `json:"attribute_value,omitempty" xml:"attribute_value,omitempty"`
// aliexpress attribute value id, which could be obtained from aliexpress.solution.sku.attribute.query
AliexpressAttributeValueId int64 `json:"aliexpress_attribute_value_id,omitempty" xml:"aliexpress_attribute_value_id,omitempty"`
// aliexpress attribute name id, which could be obtained from aliexpress.solution.sku.attribute.query
AliexpressAttributeNameId int64 `json:"aliexpress_attribute_name_id,omitempty" xml:"aliexpress_attribute_name_id,omitempty"`
}
var poolAttributeDto = sync.Pool{
New: func() any {
return new(AttributeDto)
},
}
// GetAttributeDto() 从对象池中获取AttributeDto
func GetAttributeDto() *AttributeDto {
return poolAttributeDto.Get().(*AttributeDto)
}
// ReleaseAttributeDto 释放AttributeDto
func ReleaseAttributeDto(v *AttributeDto) {
v.AttributeName = ""
v.AttributeValue = ""
v.AliexpressAttributeValueId = 0
v.AliexpressAttributeNameId = 0
poolAttributeDto.Put(v)
}