-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor] Unify repo search order by logic #30876
base: main
Are you sure you want to change the base?
Conversation
// SearchOrderByFlatMap is similar to SearchOrderByMap but use human language keywords | ||
// to decide between asc and desc | ||
var SearchOrderByFlatMap = map[string]db.SearchOrderBy{ | ||
"newest": SearchOrderByMap["desc"]["created"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this make it easyer to match human keywords with api options ... but if prefered I could also use the const directly ...
I would say this refactor is ready ;) |
I will review and merge after v1.22 stable is released since it's a refactor PR. |
@lunny we now have v1.22.0 tagged :) |
@@ -18,12 +18,6 @@ const ( | |||
SearchOrderByRecentUpdated SearchOrderBy = "updated_unix DESC" | |||
SearchOrderByOldest SearchOrderBy = "created_unix ASC" | |||
SearchOrderByNewest SearchOrderBy = "created_unix DESC" | |||
SearchOrderBySize SearchOrderBy = "size ASC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keep them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because they are not generic but table "repository" specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course if there would exist an other table witch we want to order by column 'size' it should belong in generig db search ... but I did not found one - has that changed or is something planed?
have repo OrderBy definitions defined in one place and use a single type for OrderBy database options