You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
462 B
20 lines
462 B
преди 6 години
|
package utils
|
||
|
|
||
|
type Page struct {
|
||
|
PageNo int
|
||
|
PageSize int
|
||
|
TotalPage int
|
||
|
TotalCount int
|
||
|
FirstPage bool
|
||
|
LastPage bool
|
||
|
List interface{}
|
||
|
}
|
||
|
|
||
|
func PageUtil(count int, pageNo int, pageSize int, list interface{}) Page {
|
||
|
tp := count / pageSize
|
||
|
if count % pageSize > 0 {
|
||
|
tp = count / pageSize + 1
|
||
|
}
|
||
|
return Page{PageNo: pageNo, PageSize: pageSize, TotalPage: tp, TotalCount: count, FirstPage: pageNo == 1, LastPage: pageNo == tp, List: list}
|
||
|
}
|