chore: cache username

This commit is contained in:
CaIon committed 2024-01-11 18:40:44 +08:00
1 parent d72d8852cd
commit 5eaa5bf050
4 files changed
+40 -8

No files matched your search

+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
}