Skip to content

Commit

Permalink
Pass correct context (#18638)
Browse files Browse the repository at this point in the history
- Pass the correct context into `db.GetEngine()`.
- Introduced in: #18604
  • Loading branch information
Gusted authored Feb 6, 2022
1 parent ce8eb20 commit 7a42e35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ func GetUserNamesByIDs(ids []int64) ([]string, error) {
// GetUserNameByID returns username for the id
func GetUserNameByID(ctx context.Context, id int64) (string, error) {
var name string
has, err := db.GetEngine(db.DefaultContext).Table("user").Where("id = ?", id).Cols("name").Get(&name)
has, err := db.GetEngine(ctx).Table("user").Where("id = ?", id).Cols("name").Get(&name)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 7a42e35

Please sign in to comment.