parent
c4d37d1da8
commit
8cfb5d7869
|
@ -47,6 +47,15 @@ func DbPageQuery(database *gorm.DB, query PageQuery, paginationLimit int, result
|
||||||
Find(result)
|
Find(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(args) == 0 { // here used with db.Where(&User{Name: "jinzhu", Age: 20}).First(&user)
|
||||||
|
return database.Limit(paginationLimit).
|
||||||
|
Offset(GetPageOffset(query.Page, paginationLimit)).
|
||||||
|
Where(whereQuery).
|
||||||
|
Order(orderBy).
|
||||||
|
Find(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
// here used with "name = ?", "jinzhu"
|
||||||
return database.Limit(paginationLimit).
|
return database.Limit(paginationLimit).
|
||||||
Offset(GetPageOffset(query.Page, paginationLimit)).
|
Offset(GetPageOffset(query.Page, paginationLimit)).
|
||||||
Where(whereQuery, args).
|
Where(whereQuery, args).
|
||||||
|
|
Loading…
Reference in New Issue