mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-16 06:46:16 +01:00
12e23ee199
have repo OrderBy definitions defined in one place and use a single type for OrderBy database options (cherry picked from commit bb04311b0b5b7a28f94c4bc409db1c4a04bcef17)
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package db
|
|
|
|
// SearchOrderBy is used to sort the result
|
|
type SearchOrderBy string
|
|
|
|
func (s SearchOrderBy) String() string {
|
|
return string(s)
|
|
}
|
|
|
|
// Strings for sorting result
|
|
const (
|
|
SearchOrderByAlphabetically SearchOrderBy = "name ASC"
|
|
SearchOrderByAlphabeticallyReverse SearchOrderBy = "name DESC"
|
|
SearchOrderByLeastUpdated SearchOrderBy = "updated_unix ASC"
|
|
SearchOrderByRecentUpdated SearchOrderBy = "updated_unix DESC"
|
|
SearchOrderByOldest SearchOrderBy = "created_unix ASC"
|
|
SearchOrderByNewest SearchOrderBy = "created_unix DESC"
|
|
SearchOrderByID SearchOrderBy = "id ASC"
|
|
SearchOrderByIDReverse SearchOrderBy = "id DESC"
|
|
SearchOrderByStars SearchOrderBy = "num_stars ASC"
|
|
SearchOrderByStarsReverse SearchOrderBy = "num_stars DESC"
|
|
SearchOrderByForks SearchOrderBy = "num_forks ASC"
|
|
SearchOrderByForksReverse SearchOrderBy = "num_forks DESC"
|
|
)
|
|
|
|
const (
|
|
// Which means a condition to filter the records which don't match any id.
|
|
// It's different from zero which means the condition could be ignored.
|
|
NoConditionID = -1
|
|
)
|