-
Notifications
You must be signed in to change notification settings - Fork 9
/
ActivityDto.go
40 lines (35 loc) · 922 Bytes
/
ActivityDto.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 charity
import (
"sync"
)
// ActivityDto 结构体
type ActivityDto struct {
// 活动标题
Name string `json:"name,omitempty" xml:"name,omitempty"`
// 活动摘要
Summary string `json:"summary,omitempty" xml:"summary,omitempty"`
// 活动内容
Content string `json:"content,omitempty" xml:"content,omitempty"`
// 开始时间
StartTime string `json:"start_time,omitempty" xml:"start_time,omitempty"`
// 结束时间
EndTime string `json:"end_time,omitempty" xml:"end_time,omitempty"`
}
var poolActivityDto = sync.Pool{
New: func() any {
return new(ActivityDto)
},
}
// GetActivityDto() 从对象池中获取ActivityDto
func GetActivityDto() *ActivityDto {
return poolActivityDto.Get().(*ActivityDto)
}
// ReleaseActivityDto 释放ActivityDto
func ReleaseActivityDto(v *ActivityDto) {
v.Name = ""
v.Summary = ""
v.Content = ""
v.StartTime = ""
v.EndTime = ""
poolActivityDto.Put(v)
}