add username for redis

This commit is contained in:
ginuerzh
2024-09-25 22:05:19 +08:00
parent e22aa91571
commit dfb6cb95d0
12 changed files with 35 additions and 0 deletions
+6
View File
@@ -9,6 +9,7 @@ import (
type redisRecorderOptions struct {
db int
username string
password string
key string
}
@@ -20,6 +21,11 @@ func DBRedisRecorderOption(db int) RedisRecorderOption {
}
}
func UsernameRedisRecorderOption(username string) RedisRecorderOption {
return func(opts *redisRecorderOptions) {
opts.username = username
}
}
func PasswordRedisRecorderOption(password string) RedisRecorderOption {
return func(opts *redisRecorderOptions) {
opts.password = password