20 lines
469 B
Go
20 lines
469 B
Go
package response
|
|
|
|
import (
|
|
"demo-server/api/require"
|
|
)
|
|
|
|
type CommonPaginationRsp[Item any] struct {
|
|
List []Item `json:"list"`
|
|
Total int64 `json:"total"` // 总数
|
|
Page int `json:"page"` // 页码
|
|
Size int `json:"page_size"` // 页大小
|
|
}
|
|
|
|
func (rsp *CommonPaginationRsp[Item]) SetResult(list []Item, pagination *require.PaginationParam) {
|
|
rsp.List = list
|
|
rsp.Page = pagination.Page
|
|
rsp.Total = pagination.Total
|
|
rsp.Size = pagination.Size
|
|
}
|