fixed relationship issues

This commit is contained in:
2026-02-05 00:10:10 +11:00
parent 6a058ab636
commit 59ee880b63
22 changed files with 236 additions and 254 deletions

View File

@@ -15,6 +15,25 @@ type OrderOpts struct {
Label string
}
func setDefaultPageOpts(p *PageOpts, page, perpage int, order bun.Order, orderby string) *PageOpts {
if p == nil {
p = new(PageOpts)
}
if p.Page == 0 {
p.Page = page
}
if p.PerPage == 0 {
p.PerPage = perpage
}
if p.Order == "" {
p.Order = order
}
if p.OrderBy == "" {
p.OrderBy = orderby
}
return p
}
// TotalPages calculates the total number of pages
func (p *PageOpts) TotalPages(total int) int {
if p.PerPage == 0 {