Documentation
¶
Index ¶
- Constants
- func Get[T any](r Default, ctx context.Context, key string) (*T, error)
- func GetMany[T any](r Default, ctx context.Context, key string) ([]*T, error)
- func IsFollowingKey(followerID string, userID string) string
- func PrepareUserEmailKey(email string) string
- func PrepareUsernameKey(username string) string
- func SearchResultsKey(word string, limit int, offset int) string
- func TempRegistrationCodeKey(code int) string
- func TempSignInCodeKey(code int) string
- func UserByUsernameKey(username string) string
- func UserFollowersKey(userID string, limit int, offset int) string
- func UserFollowsKey(userID string, limit int, offset int) string
- func UserForgotPasswordCodeKey(code int) string
- func UserKey(userID string) string
- type Default
- type RedisRepository
Constants ¶
View Source
const ( USER_KEY = "user:%s" // <userID> USER_BY_USERNAME_KEY = "user-name:%s" // <username> TEMP_REGISTRATION_CODE_KEY = "registration-code:%d" // <registration code> TEMP_SIGNIN_CODE_KEY = "sign-in-code:%d" // <sign-in code> SEARCH_RESULTS_KEY = "search-results:%s:%d:%d" // <any word>:<limit>:<offset> USER_FOLLOWERS_KEY = "user-followers:%s:%d:%d" // <userID>:<limit>:<offset> USER_FOLLOWS_KEY = "user-follows:%s:%d:%d" // <userID>:<limit>:<offset> IS_FOLLOWING_KEY = "%s-is-following:%s" // <followerID>:<userID> PREPARE_USERNAME_KEY = "%s-prepare-for-registration" // <username> PREPARE_USER_EMAIL_KEY = "%s-prepare-for-registration" // <email> USER_FORGOT_PASSWORD_CODE_KEY = "forgot-password-code:%d" // <code> )
Variables ¶
This section is empty.
Functions ¶
func IsFollowingKey ¶
func PrepareUserEmailKey ¶
func PrepareUsernameKey ¶
func TempRegistrationCodeKey ¶
func TempSignInCodeKey ¶
func UserByUsernameKey ¶
Types ¶
type Default ¶
type Default interface { Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error SetJSON(ctx context.Context, key string, value interface{}, ttl time.Duration) error Get(ctx context.Context, key string) *redis.StringCmd Del(ctx context.Context, keys ...string) *redis.IntCmd }
type RedisRepository ¶
type RedisRepository struct {
Default
}
func New ¶
func New(rdb *redis.Client) *RedisRepository
Click to show internal directories.
Click to hide internal directories.