redisrepo

package
v0.0.0-...-ce28711 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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 Get

func Get[T any](r Default, ctx context.Context, key string) (*T, error)

func GetMany

func GetMany[T any](r Default, ctx context.Context, key string) ([]*T, error)

func IsFollowingKey

func IsFollowingKey(followerID string, userID string) string

func PrepareUserEmailKey

func PrepareUserEmailKey(email string) string

func PrepareUsernameKey

func PrepareUsernameKey(username string) string

func SearchResultsKey

func SearchResultsKey(word string, limit int, offset int) string

func TempRegistrationCodeKey

func TempRegistrationCodeKey(code int) string

func TempSignInCodeKey

func TempSignInCodeKey(code int) string

func UserByUsernameKey

func UserByUsernameKey(username string) string

func UserFollowersKey

func UserFollowersKey(userID string, limit int, offset int) string

func UserFollowsKey

func UserFollowsKey(userID string, limit int, offset int) string

func UserForgotPasswordCodeKey

func UserForgotPasswordCodeKey(code int) string

func UserKey

func UserKey(userID string) string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL