pagination.go 325 B

1234567891011121314151617181920
  1. package dto
  2. type Pagination struct {
  3. Page int `form:"page" example:"1"`
  4. PageSize int `form:"pageSize" example:"10"`
  5. }
  6. func (m *Pagination) GetPageIndex() int {
  7. if m.Page <= 0 {
  8. m.Page = 1
  9. }
  10. return m.Page
  11. }
  12. func (m *Pagination) GetPageSize() int {
  13. if m.PageSize <= 0 {
  14. m.PageSize = 10
  15. }
  16. return m.PageSize
  17. }