-
Notifications
You must be signed in to change notification settings - Fork 9
/
ServiceAttributeDto.go
37 lines (32 loc) · 1.21 KB
/
ServiceAttributeDto.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 waybill
import (
"sync"
)
// ServiceAttributeDto 结构体
type ServiceAttributeDto struct {
// 属性的值,用户实际传入的值
AttributeCode string `json:"attribute_code,omitempty" xml:"attribute_code,omitempty"`
// 属性的名称,可以用于前端的展示
AttributeName string `json:"attribute_name,omitempty" xml:"attribute_name,omitempty"`
// 属性的类型,可能值有 [number, string, enum]
AttributeType string `json:"attribute_type,omitempty" xml:"attribute_type,omitempty"`
// 枚举类型的枚举值,key为用户选中的需要传值的数据,value为对应的描述,可以作为前端的展示
TypeDesc string `json:"type_desc,omitempty" xml:"type_desc,omitempty"`
}
var poolServiceAttributeDto = sync.Pool{
New: func() any {
return new(ServiceAttributeDto)
},
}
// GetServiceAttributeDto() 从对象池中获取ServiceAttributeDto
func GetServiceAttributeDto() *ServiceAttributeDto {
return poolServiceAttributeDto.Get().(*ServiceAttributeDto)
}
// ReleaseServiceAttributeDto 释放ServiceAttributeDto
func ReleaseServiceAttributeDto(v *ServiceAttributeDto) {
v.AttributeCode = ""
v.AttributeName = ""
v.AttributeType = ""
v.TypeDesc = ""
poolServiceAttributeDto.Put(v)
}