To gitea and beyond, let's go(-yco)
This commit is contained in:
13
internal/repositories/pagination.go
Normal file
13
internal/repositories/pagination.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package repositories
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
func ApplyPagination(query *gorm.DB, limit, offset int) *gorm.DB {
|
||||
if limit > 0 {
|
||||
query = query.Limit(limit)
|
||||
}
|
||||
if offset > 0 {
|
||||
query = query.Offset(offset)
|
||||
}
|
||||
return query
|
||||
}
|
||||
Reference in New Issue
Block a user