|
|
|
@ -5,8 +5,8 @@ package repo |
|
|
|
|
|
|
|
|
|
import "code.gitea.io/gitea/models/db" |
|
|
|
|
|
|
|
|
|
// SearchOrderByMap represents all possible search order
|
|
|
|
|
var SearchOrderByMap = map[string]map[string]db.SearchOrderBy{ |
|
|
|
|
// OrderByMap represents all possible search order
|
|
|
|
|
var OrderByMap = map[string]map[string]db.SearchOrderBy{ |
|
|
|
|
"asc": { |
|
|
|
|
"alpha": "owner_name ASC, name ASC", |
|
|
|
|
"created": db.SearchOrderByOldest, |
|
|
|
@ -31,22 +31,22 @@ var SearchOrderByMap = map[string]map[string]db.SearchOrderBy{ |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SearchOrderByFlatMap is similar to SearchOrderByMap but use human language keywords
|
|
|
|
|
// OrderByFlatMap is similar to OrderByMap but use human language keywords
|
|
|
|
|
// to decide between asc and desc
|
|
|
|
|
var SearchOrderByFlatMap = map[string]db.SearchOrderBy{ |
|
|
|
|
"newest": SearchOrderByMap["desc"]["created"], |
|
|
|
|
"oldest": SearchOrderByMap["asc"]["created"], |
|
|
|
|
"leastupdate": SearchOrderByMap["asc"]["updated"], |
|
|
|
|
"reversealphabetically": SearchOrderByMap["desc"]["alpha"], |
|
|
|
|
"alphabetically": SearchOrderByMap["asc"]["alpha"], |
|
|
|
|
"reversesize": SearchOrderByMap["desc"]["size"], |
|
|
|
|
"size": SearchOrderByMap["asc"]["size"], |
|
|
|
|
"reversegitsize": SearchOrderByMap["desc"]["git_size"], |
|
|
|
|
"gitsize": SearchOrderByMap["asc"]["git_size"], |
|
|
|
|
"reverselfssize": SearchOrderByMap["desc"]["lfs_size"], |
|
|
|
|
"lfssize": SearchOrderByMap["asc"]["lfs_size"], |
|
|
|
|
"moststars": SearchOrderByMap["desc"]["stars"], |
|
|
|
|
"feweststars": SearchOrderByMap["asc"]["stars"], |
|
|
|
|
"mostforks": SearchOrderByMap["desc"]["forks"], |
|
|
|
|
"fewestforks": SearchOrderByMap["asc"]["forks"], |
|
|
|
|
var OrderByFlatMap = map[string]db.SearchOrderBy{ |
|
|
|
|
"newest": OrderByMap["desc"]["created"], |
|
|
|
|
"oldest": OrderByMap["asc"]["created"], |
|
|
|
|
"leastupdate": OrderByMap["asc"]["updated"], |
|
|
|
|
"reversealphabetically": OrderByMap["desc"]["alpha"], |
|
|
|
|
"alphabetically": OrderByMap["asc"]["alpha"], |
|
|
|
|
"reversesize": OrderByMap["desc"]["size"], |
|
|
|
|
"size": OrderByMap["asc"]["size"], |
|
|
|
|
"reversegitsize": OrderByMap["desc"]["git_size"], |
|
|
|
|
"gitsize": OrderByMap["asc"]["git_size"], |
|
|
|
|
"reverselfssize": OrderByMap["desc"]["lfs_size"], |
|
|
|
|
"lfssize": OrderByMap["asc"]["lfs_size"], |
|
|
|
|
"moststars": OrderByMap["desc"]["stars"], |
|
|
|
|
"feweststars": OrderByMap["asc"]["stars"], |
|
|
|
|
"mostforks": OrderByMap["desc"]["forks"], |
|
|
|
|
"fewestforks": OrderByMap["asc"]["forks"], |
|
|
|
|
} |
|
|
|
|