Skip to content
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

Use custom type and constants to hold available order by options #2572

Merged
merged 1 commit into from
Sep 22, 2017

Conversation

Morlinest
Copy link
Member

Extracted from #2371. Replace strings for constants.

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Sep 22, 2017
@lunny lunny added this to the 1.3.0 milestone Sep 22, 2017
@codecov-io
Copy link

Codecov Report

Merging #2572 into master will increase coverage by <.01%.
The diff coverage is 23.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2572      +/-   ##
==========================================
+ Coverage   27.32%   27.33%   +<.01%     
==========================================
  Files          86       86              
  Lines       17135    17137       +2     
==========================================
+ Hits         4682     4684       +2     
  Misses      11775    11775              
  Partials      678      678
Impacted Files Coverage Δ
routers/user/profile.go 0% <0%> (ø) ⬆️
models/repo_list.go 24.72% <57.14%> (+0.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca68a75...be45800. Read the comment docs.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 22, 2017
@lafriks
Copy link
Member

lafriks commented Sep 22, 2017

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 22, 2017
@daviian
Copy link
Member

daviian commented Sep 22, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 22, 2017
//SearchOrderBy is used to sort the result
type SearchOrderBy string

func (s SearchOrderBy) String() string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually just reviewed it again and does that function is needed? Why not to use string(x) where needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you don't need to care what type SearchOrderBy is (try to think about it like you don't know that it's only string) and this way it implements Stringer interface. string(x) will not work without other changes if you change SearchOrderBy to int for example. Changing constants should not affect other code.

@lafriks lafriks merged commit 9a75a5d into go-gitea:master Sep 22, 2017
@Morlinest Morlinest deleted the feature/use-order-by-custom-type branch September 22, 2017 12:59
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants