rm const do inline (#31360)

https://github.com/go-gitea/gitea/pull/30876/files#r1637288202
This commit is contained in:
6543 2024-06-15 06:48:52 +02:00 committed by GitHub
parent 42718d32af
commit e37ecd1732
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 42 deletions

View File

@ -5,53 +5,29 @@ package repo
import "code.gitea.io/gitea/models/db" 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 // SearchOrderByMap represents all possible search order
var SearchOrderByMap = map[string]map[string]db.SearchOrderBy{ var SearchOrderByMap = map[string]map[string]db.SearchOrderBy{
"asc": { "asc": {
"alpha": SearchOrderByAlphabetically, "alpha": "owner_name ASC, name ASC",
"created": SearchOrderByOldest, "created": db.SearchOrderByOldest,
"updated": SearchOrderByLeastUpdated, "updated": db.SearchOrderByLeastUpdated,
"size": SearchOrderBySize, "size": "size ASC",
"git_size": SearchOrderByGitSize, "git_size": "git_size ASC",
"lfs_size": SearchOrderByLFSSize, "lfs_size": "lfs_size ASC",
"id": SearchOrderByID, "id": db.SearchOrderByID,
"stars": SearchOrderByStars, "stars": db.SearchOrderByStars,
"forks": SearchOrderByForks, "forks": db.SearchOrderByForks,
}, },
"desc": { "desc": {
"alpha": SearchOrderByAlphabeticallyReverse, "alpha": "owner_name DESC, name DESC",
"created": SearchOrderByNewest, "created": db.SearchOrderByNewest,
"updated": SearchOrderByRecentUpdated, "updated": db.SearchOrderByRecentUpdated,
"size": SearchOrderBySizeReverse, "size": "size DESC",
"git_size": SearchOrderByGitSizeReverse, "git_size": "git_size DESC",
"lfs_size": SearchOrderByLFSSizeReverse, "lfs_size": "lfs_size DESC",
"id": SearchOrderByIDReverse, "id": db.SearchOrderByIDReverse,
"stars": SearchOrderByStarsReverse, "stars": db.SearchOrderByStarsReverse,
"forks": SearchOrderByForksReverse, "forks": db.SearchOrderByForksReverse,
}, },
} }