first commit

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
HouYunFei
2026-05-19 07:53:53 +08:00
commit 472bf8b732
133 changed files with 16869 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
package model
const MaxPageSize = 500
// Query 列表筛选和分页参数。
type Query struct {
Keyword string
Tags []string
Category string
Type string
Page int
PageSize int
}
func (q *Query) Normalize() {
if q.Page < 1 {
q.Page = 1
}
if q.PageSize < 1 {
q.PageSize = 20
}
if q.PageSize > MaxPageSize {
q.PageSize = MaxPageSize
}
}
func (q *Query) Offset() int {
return (q.Page - 1) * q.PageSize
}