redisx

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Del

func Del(key string) error

func GetBool

func GetBool(key string) (bool, error)

func GetByte

func GetByte(key string) ([]byte, error)

func GetClient

func GetClient() *redis.Client

func GetFloat32

func GetFloat32(key string) (float32, error)

func GetFloat64

func GetFloat64(key string) (float64, error)

func GetInt

func GetInt(key string) (int, error)

func GetInt64

func GetInt64(key string) (int64, error)

func GetString

func GetString(key string) (string, error)

func GetStringMapString

func GetStringMapString(key string) (map[string]string, error)

func GetUint64

func GetUint64(key string) (uint64, error)

func HSet

func HSet(key string, val ...any) error

HSet accepts values in following formats:

  • HSet("myhash", "key1", "value1", "key2", "value2")
  • HSet("myhash", []string{"key1", "value1", "key2", "value2"})
  • HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

func Init

func Init(opts ...Opt)

func Persist

func Persist(key string) error

func Set

func Set(key string, val any) error

func SetNx

func SetNx(key string, val any, expiration time.Duration) error

func TTL

func TTL(key string) (time.Duration, error)

func UseConn

func UseConn(run func(conn *redis.Conn) error) error

Types

type Config

type Config struct {
	Host     string
	Port     int
	Password string
	DB       int

	Ctx context.Context
}

type Opt

type Opt func(c *Config)

func SetCtx

func SetCtx(ctx context.Context) Opt

func SetDb

func SetDb(db int) Opt

func SetHost

func SetHost(host string) Opt

func SetPassword

func SetPassword(pass string) Opt

func SetPort

func SetPort(port int) Opt

Jump to

Keyboard shortcuts

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