chore: cache username

This commit is contained in:
CaIon
2024-01-11 18:40:44 +08:00
parent d72d8852cd
commit 5eaa5bf050
4 changed files with 40 additions and 8 deletions
+3 -3
View File
@@ -452,7 +452,7 @@ func updateUserRequestCount(id int, count int) {
}
}
func GetUsernameById(id int) (username string) {
DB.Model(&User{}).Where("id = ?", id).Select("username").Find(&username)
return username
func GetUsernameById(id int) (username string, err error) {
err = DB.Model(&User{}).Where("id = ?", id).Select("username").Find(&username).Error
return username, err
}