first commit

This commit is contained in:
Yangtao
2025-11-18 17:48:20 +08:00
commit 6e56cab848
196 changed files with 65809 additions and 0 deletions

30
pkg/common/req/req.go Normal file
View File

@ -0,0 +1,30 @@
package req
const (
defaultPage = 1
defaultSize = 10
)
type Page struct {
Page int64 `json:"page" form:"page" uri:"page"`
Size int64 `json:"size" form:"size" uri:"size"`
}
func (p *Page) check() {
if p.Page < 1 {
p.Page = defaultPage
}
if p.Size <= 0 {
p.Size = defaultSize
}
}
func (p *Page) Offset() int {
p.check()
return int(p.Page*p.Size - p.Size)
}
func (p *Page) Limit() int {
p.check()
return int(p.Size)
}