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 ID or Where to instead directly use Get when load object from database #11925

Merged
merged 3 commits into from
Jun 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: 6543 <[email protected]>
  • Loading branch information
lunny and 6543 committed Jun 17, 2020
commit 4e4ee05e4d1dc93e30a63dec011151faab9168c5
4 changes: 2 additions & 2 deletions models/branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func getProtectedBranchBy(e Engine, repoID int64, branchName string) (*Protected
// GetProtectedBranchByID getting protected branch by ID
func GetProtectedBranchByID(id int64) (*ProtectedBranch, error) {
rel := &ProtectedBranch{}
has, err := x.Where("id=?", id).Get(rel)
has, err := x.ID(id).Get(rel)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -511,7 +511,7 @@ func (repo *Repository) GetDeletedBranches() ([]*DeletedBranch, error) {
// GetDeletedBranchByID get a deleted branch by its ID
func (repo *Repository) GetDeletedBranchByID(id int64) (*DeletedBranch, error) {
deletedBranch := &DeletedBranch{}
has, err := x.Where("id=?", id).Get(deletedBranch)
has, err := x.ID(id).Get(deletedBranch)
if err != nil {
return nil, err
}
Expand Down