rm const do inline (#31360)

https://github.com/go-gitea/gitea/pull/30876/files#r1637288202
(cherry picked from commit e37ecd17324946d9b2db07ea10d4a9fbb53da20f)
This commit is contained in:
6543 2024-06-15 06:48:52 +02:00 committed by Earl Warren
parent 813bf24445
commit 5d10c3446a
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -5,53 +5,29 @@ package repo
import "code.gitea.io/gitea/models/db"
// Strings for sorting result
const (
// only used for repos
SearchOrderByAlphabetically db.SearchOrderBy = "owner_name ASC, name ASC"
SearchOrderByAlphabeticallyReverse db.SearchOrderBy = "owner_name DESC, name DESC"
SearchOrderBySize db.SearchOrderBy = "size ASC"
SearchOrderBySizeReverse db.SearchOrderBy = "size DESC"
SearchOrderByGitSize db.SearchOrderBy = "git_size ASC"
SearchOrderByGitSizeReverse db.SearchOrderBy = "git_size DESC"
SearchOrderByLFSSize db.SearchOrderBy = "lfs_size ASC"
SearchOrderByLFSSizeReverse db.SearchOrderBy = "lfs_size DESC"
// alias as also used elsewhere
SearchOrderByLeastUpdated db.SearchOrderBy = db.SearchOrderByLeastUpdated
SearchOrderByRecentUpdated db.SearchOrderBy = db.SearchOrderByRecentUpdated
SearchOrderByOldest db.SearchOrderBy = db.SearchOrderByOldest
SearchOrderByNewest db.SearchOrderBy = db.SearchOrderByNewest
SearchOrderByID db.SearchOrderBy = db.SearchOrderByID
SearchOrderByIDReverse db.SearchOrderBy = db.SearchOrderByIDReverse
SearchOrderByStars db.SearchOrderBy = db.SearchOrderByStars
SearchOrderByStarsReverse db.SearchOrderBy = db.SearchOrderByStarsReverse
SearchOrderByForks db.SearchOrderBy = db.SearchOrderByForks
SearchOrderByForksReverse db.SearchOrderBy = db.SearchOrderByForksReverse
)
// SearchOrderByMap represents all possible search order
var SearchOrderByMap = map[string]map[string]db.SearchOrderBy{
"asc": {
"alpha": SearchOrderByAlphabetically,
"created": SearchOrderByOldest,
"updated": SearchOrderByLeastUpdated,
"size": SearchOrderBySize,
"git_size": SearchOrderByGitSize,
"lfs_size": SearchOrderByLFSSize,
"id": SearchOrderByID,
"stars": SearchOrderByStars,
"forks": SearchOrderByForks,
"alpha": "owner_name ASC, name ASC",
"created": db.SearchOrderByOldest,
"updated": db.SearchOrderByLeastUpdated,
"size": "size ASC",
"git_size": "git_size ASC",
"lfs_size": "lfs_size ASC",
"id": db.SearchOrderByID,
"stars": db.SearchOrderByStars,
"forks": db.SearchOrderByForks,
},
"desc": {
"alpha": SearchOrderByAlphabeticallyReverse,
"created": SearchOrderByNewest,
"updated": SearchOrderByRecentUpdated,
"size": SearchOrderBySizeReverse,
"git_size": SearchOrderByGitSizeReverse,
"lfs_size": SearchOrderByLFSSizeReverse,
"id": SearchOrderByIDReverse,
"stars": SearchOrderByStarsReverse,
"forks": SearchOrderByForksReverse,
"alpha": "owner_name DESC, name DESC",
"created": db.SearchOrderByNewest,
"updated": db.SearchOrderByRecentUpdated,
"size": "size DESC",
"git_size": "git_size DESC",
"lfs_size": "lfs_size DESC",
"id": db.SearchOrderByIDReverse,
"stars": db.SearchOrderByStarsReverse,
"forks": db.SearchOrderByForksReverse,
},
}