where clause

main v1.0.19
alex 2023-11-26 00:24:27 +01:00
parent 930ef2120e
commit 39ef3fa9e5
1 changed files with 7 additions and 7 deletions

View File

@ -36,16 +36,16 @@ type PageQuery struct {
}
func DbPageQuery(database *gorm.DB, query PageQuery, paginationLimit int, result any, orderBy string, whereQuery interface{}, args ...interface{}) *gorm.DB {
if whereQuery == nil {
return database.Limit(paginationLimit).
Offset(GetPageOffset(query.Page, paginationLimit)).
Where(whereQuery, args).
Order(orderBy).
Find(result)
}
func DbPageQueryWithoutWhere(database *gorm.DB, query PageQuery, paginationLimit int, result any, orderBy string) *gorm.DB {
return database.Limit(paginationLimit).
Offset(GetPageOffset(query.Page, paginationLimit)).
Where(whereQuery, args).
Order(orderBy).
Find(result)
}