4c24318cb3
* Remove useless .Table() from db usage This is handled via TableName() already * Optimization: omit file-list fetching for old torrents * Use seperate tables for reports & files on sukebei * Fix invalid pages in nav if <5 pages total
14 lignes
466 o
Go
14 lignes
466 o
Go
package commentService
|
|
|
|
import (
|
|
"github.com/NyaaPantsu/nyaa/db"
|
|
"github.com/NyaaPantsu/nyaa/model"
|
|
)
|
|
|
|
func GetAllComments(limit int, offset int, conditions string, values ...interface{}) ([]model.Comment, int) {
|
|
var comments []model.Comment
|
|
var nbComments int
|
|
db.ORM.Model(&comments).Where(conditions, values...).Count(&nbComments)
|
|
db.ORM.Preload("User").Limit(limit).Offset(offset).Where(conditions, values...).Find(&comments)
|
|
return comments, nbComments
|
|
}
|