-
Notifications
You must be signed in to change notification settings - Fork 9
/
Contents.go
49 lines (44 loc) · 1.16 KB
/
Contents.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
41
42
43
44
45
46
47
48
49
package alihealthcrm
import (
"sync"
)
// Contents 结构体
type Contents struct {
// 商品列表
Items []string `json:"items,omitempty" xml:"items>string,omitempty"`
// 文章标题
Title string `json:"title,omitempty" xml:"title,omitempty"`
// 文章标签
Tags string `json:"tags,omitempty" xml:"tags,omitempty"`
// 图片
PhotoUrl string `json:"photo_url,omitempty" xml:"photo_url,omitempty"`
// 内容
Content string `json:"content,omitempty" xml:"content,omitempty"`
// 链接
LinkUrl string `json:"link_url,omitempty" xml:"link_url,omitempty"`
// publishTime
PublishTime string `json:"publish_time,omitempty" xml:"publish_time,omitempty"`
// 商品计数
ItemCount int64 `json:"item_count,omitempty" xml:"item_count,omitempty"`
}
var poolContents = sync.Pool{
New: func() any {
return new(Contents)
},
}
// GetContents() 从对象池中获取Contents
func GetContents() *Contents {
return poolContents.Get().(*Contents)
}
// ReleaseContents 释放Contents
func ReleaseContents(v *Contents) {
v.Items = v.Items[:0]
v.Title = ""
v.Tags = ""
v.PhotoUrl = ""
v.Content = ""
v.LinkUrl = ""
v.PublishTime = ""
v.ItemCount = 0
poolContents.Put(v)
}