package dto type Pagination struct { Page int `form:"page" example:"1"` PageSize int `form:"pageSize" example:"10"` } func (m *Pagination) GetPageIndex() int { if m.Page <= 0 { m.Page = 1 } return m.Page } func (m *Pagination) GetPageSize() int { if m.PageSize <= 0 { m.PageSize = 10 } return m.PageSize }