-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Pagination on releases page #2035
Changes from 8 commits
3cbc3e2
2046b2a
686ce04
58e90fb
3d6fa22
db54407
608579e
1f627f7
cd8fc18
9fbeb76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,6 +244,15 @@ func GetReleasesByRepoID(repoID int64, page, pageSize int) (rels []*Release, err | |
return rels, err | ||
} | ||
|
||
// GetReleaseCountByRepoID returns the count of releases of repository | ||
func GetReleaseCountByRepoID(repoID int64, isOwner bool) (total int64, err error) { | ||
if isOwner { | ||
return x.Where("repo_id = ?", repoID).Count(&Release{}) | ||
} | ||
|
||
return x.Where("repo_id = ? AND is_prerelease = 0 AND is_draft = 0", repoID).Count(&Release{}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you should use a Cond struct instead of a string, similar to this and then you can pass it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also this probably wont work in postgres as I think xorm creates bool columns in it. |
||
} | ||
|
||
// GetReleasesByRepoIDAndNames returns a list of releases of repository according repoID and tagNames. | ||
func GetReleasesByRepoIDAndNames(repoID int64, tagNames []string) (rels []*Release, err error) { | ||
err = x. | ||
|
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.
includeDrafts
would be more clear thanisOwner
.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.
just
(int64, error)
would be better