-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Rewrite raw queries #136
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
Rewrite raw queries #136
Conversation
…orm-queries # Conflicts: # models/git_diff.go # models/issue.go # models/org.go # models/pull.go # models/repo.go
Current coverage is 3.03% (diff: 0.00%)@@ master #136 diff @@
========================================
Files 33 33
Lines 7845 8096 +251
Methods 0 0
Messages 0 0
Branches 0 0
========================================
Hits 246 246
- Misses 7579 7830 +251
Partials 20 20
|
Where("(`repository`.owner_id=? AND `repository`.is_private=?)", org.ID, false). | ||
Or("team_repo.team_id IN (?)", strings.Join(base.Int64sToStrings(teamIDs), ",")). | ||
GroupBy("`repository`.id"). | ||
Count(&Repository{}) |
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.
👍
@@ -127,7 +127,9 @@ func GetRelease(repoID int64, tagName string) (*Release, error) { | |||
// GetReleaseByID returns release with given ID. | |||
func GetReleaseByID(id int64) (*Release, error) { | |||
rel := new(Release) | |||
has, err := x.Id(id).Get(rel) | |||
has, 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.
I think this could have be left on line, it's not that long. But it's nitpicking.
Overall really awesome changes! My only comment is one may lines that could have been left one-liners. There's really no need to write err = x.
Where("org_id=?", orgID).
And("is_active=?", true).
Find(&ws) instead of: err = x.Where("org_id=?", orgID).And("is_active=?", true).Find(&ws) It's not that much. LGTM |
Somethings fall to personal preference. I prefer it in multiple lines, but I'm OK with any style. I'd also prefer some more spaces inside SQLs: x.Where("org_id = ?", orgID)
// instead of
x.Where("org_id=?", orgID) |
LGTM |
gofmt
on all model files