mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-27 00:51:55 +08:00
feat(database): support postgres (#43)
Co-authored-by: Li4n0 <[email protected]>
This commit is contained in:
+2
-2
@@ -40,7 +40,7 @@ func (r *Rule) CreateOrUpdate() (err error) {
|
||||
[]string{
|
||||
"name",
|
||||
"flag_format",
|
||||
"rank",
|
||||
"base_rank",
|
||||
"push_to_client",
|
||||
"notice",
|
||||
}),
|
||||
@@ -112,7 +112,7 @@ func ListRules(c *gin.Context) {
|
||||
order = "desc"
|
||||
}
|
||||
|
||||
if err := db.Order("`rank` desc").Order("id" + " " + order).Count(&count).Offset((page - 1) * pageSize).Limit(pageSize).Find(&res).Error; err != nil {
|
||||
if err := db.Order("base_rank desc").Order("id" + " " + order).Count(&count).Offset((page - 1) * pageSize).Limit(pageSize).Find(&res).Error; err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
"error": err.Error(),
|
||||
|
||||
Reference in New Issue
Block a user