redis

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

mysql

封装了go-redis/v8 的使用,简化了连接配置

func TestInit(t *testing.T) {
	init, err := Init(SetConf(Conf{
		Addr:     "localhost:6379",
		Password: "",
		DB:       0,
	}))
	if err != nil {
		t.Error(err)
		return
	}
	t.Log(init)
}

OutPut:

Redis<localhost:6379 db:0>

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(opts ...Option) (*redis.Client, error)

Types

type Conf

type Conf struct {
	Addr     string `yaml:"addr"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`
}

type Option

type Option func(r *_Redis)

func SetConf

func SetConf(conf Conf) Option

Jump to

Keyboard shortcuts

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