aboutsummaryrefslogtreecommitdiff
path: root/internal/db/user_cache.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-10-09 22:55:32 +0800
committerGitHub <noreply@github.com>2022-10-09 22:55:32 +0800
commit8982a42d38c537de87fabcc59f062841f1c437c2 (patch)
treebae626255a1582feb14be4b73f5aa0a581c141ab /internal/db/user_cache.go
parentfb00e3e56fd777df96e71df1b497e50ff3fbb069 (diff)
refactor(db): move `User.HasForkedRepository` to `users.HasForkedRepository` (#7176)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/db/user_cache.go')
-rw-r--r--internal/db/user_cache.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/db/user_cache.go b/internal/db/user_cache.go
index 314ea3b1..f4fa8172 100644
--- a/internal/db/user_cache.go
+++ b/internal/db/user_cache.go
@@ -4,13 +4,17 @@
package db
+import (
+ "fmt"
+)
+
// MailResendCacheKey returns key used for cache mail resend.
func (u *User) MailResendCacheKey() string {
- return "MailResend_" + u.IDStr()
+ return fmt.Sprintf("MailResend_%d", u.ID)
}
// TwoFactorCacheKey returns key used for cache two factor passcode.
// e.g. TwoFactor_1_012664
func (u *User) TwoFactorCacheKey(passcode string) string {
- return "TwoFactor_" + u.IDStr() + "_" + passcode
+ return fmt.Sprintf("TwoFactor_%d_%s", u.ID, passcode)
}