-
Notifications
You must be signed in to change notification settings - Fork 9
/
CsrPage.go
40 lines (35 loc) · 932 Bytes
/
CsrPage.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"
)
// CsrPage 结构体
type CsrPage struct {
// 分页数据
List []CsrInvoiceExternalOrgQueryResultDto `json:"list,omitempty" xml:"list>csr_invoice_external_org_query_result_dto,omitempty"`
// 总条数
Total int64 `json:"total,omitempty" xml:"total,omitempty"`
// 总页数
Pages int64 `json:"pages,omitempty" xml:"pages,omitempty"`
// 分页大小,默认20,最大100
PageSize int64 `json:"page_size,omitempty" xml:"page_size,omitempty"`
// 当前页码
PageNum int64 `json:"page_num,omitempty" xml:"page_num,omitempty"`
}
var poolCsrPage = sync.Pool{
New: func() any {
return new(CsrPage)
},
}
// GetCsrPage() 从对象池中获取CsrPage
func GetCsrPage() *CsrPage {
return poolCsrPage.Get().(*CsrPage)
}
// ReleaseCsrPage 释放CsrPage
func ReleaseCsrPage(v *CsrPage) {
v.List = v.List[:0]
v.Total = 0
v.Pages = 0
v.PageSize = 0
v.PageNum = 0
poolCsrPage.Put(v)
}