fixed relationship issues
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user