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> Expand ▾ Collapse ▴ Documentation ¶ Index ¶ func Init(opts ...Option) (*redis.Client, error) type Conf type Option func SetConf(conf Conf) Option 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 Source Files ¶ View all Source files config.goredis.go Click to show internal directories. Click to hide internal directories.