From 765918aabc8930b745ce2e3f0f72d0e22a53140f Mon Sep 17 00:00:00 2001 From: Rogee Date: Fri, 10 Jan 2025 16:56:35 +0800 Subject: [PATCH] fix: pagination --- templates/project/app/requests/pagination.go.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/project/app/requests/pagination.go.tpl b/templates/project/app/requests/pagination.go.tpl index 31bb855..af0cdef 100644 --- a/templates/project/app/requests/pagination.go.tpl +++ b/templates/project/app/requests/pagination.go.tpl @@ -9,11 +9,11 @@ type Pager struct { } type Pagination struct { - Page int `json:"page" form:"page" query:"page"` - Limit int `json:"limit" form:"limit" query:"limit"` + Page int64 `json:"page" form:"page" query:"page"` + Limit int64 `json:"limit" form:"limit" query:"limit"` } -func (filter *Pagination) Offset() int { +func (filter *Pagination) Offset() int64 { return (filter.Page - 1) * filter.Limit } @@ -22,7 +22,7 @@ func (filter *Pagination) Format() *Pagination { filter.Page = 1 } - if !lo.Contains([]int{10, 20, 50, 100}, filter.Limit) { + if !lo.Contains([]int64{10, 20, 50, 100}, filter.Limit) { filter.Limit = 10 }