mirror of https://github.com/go-redis/redis.git
Added OnConnect callback to UniversalOptions (#747)
* Added OnConnect callback to UniversalOptions
This commit is contained in:
parent
877867d284
commit
1b1fc80e20
|
@ -219,7 +219,7 @@ var _ = Describe("Commands", func() {
|
||||||
It("Should Command", func() {
|
It("Should Command", func() {
|
||||||
cmds, err := client.Command().Result()
|
cmds, err := client.Command().Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(len(cmds)).To(BeNumerically("~", 180, 10))
|
Expect(len(cmds)).To(BeNumerically("~", 185, 10))
|
||||||
|
|
||||||
cmd := cmds["mget"]
|
cmd := cmds["mget"]
|
||||||
Expect(cmd.Name).To(Equal("mget"))
|
Expect(cmd.Name).To(Equal("mget"))
|
||||||
|
|
|
@ -27,6 +27,7 @@ type UniversalOptions struct {
|
||||||
|
|
||||||
// Common options
|
// Common options
|
||||||
|
|
||||||
|
OnConnect func(*Conn) error
|
||||||
MaxRetries int
|
MaxRetries int
|
||||||
Password string
|
Password string
|
||||||
DialTimeout time.Duration
|
DialTimeout time.Duration
|
||||||
|
@ -49,6 +50,7 @@ func (o *UniversalOptions) cluster() *ClusterOptions {
|
||||||
RouteByLatency: o.RouteByLatency,
|
RouteByLatency: o.RouteByLatency,
|
||||||
ReadOnly: o.ReadOnly,
|
ReadOnly: o.ReadOnly,
|
||||||
|
|
||||||
|
OnConnect: o.OnConnect,
|
||||||
MaxRetries: o.MaxRetries,
|
MaxRetries: o.MaxRetries,
|
||||||
Password: o.Password,
|
Password: o.Password,
|
||||||
DialTimeout: o.DialTimeout,
|
DialTimeout: o.DialTimeout,
|
||||||
|
@ -71,6 +73,7 @@ func (o *UniversalOptions) failover() *FailoverOptions {
|
||||||
MasterName: o.MasterName,
|
MasterName: o.MasterName,
|
||||||
DB: o.DB,
|
DB: o.DB,
|
||||||
|
|
||||||
|
OnConnect: o.OnConnect,
|
||||||
MaxRetries: o.MaxRetries,
|
MaxRetries: o.MaxRetries,
|
||||||
Password: o.Password,
|
Password: o.Password,
|
||||||
DialTimeout: o.DialTimeout,
|
DialTimeout: o.DialTimeout,
|
||||||
|
@ -93,6 +96,7 @@ func (o *UniversalOptions) simple() *Options {
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
DB: o.DB,
|
DB: o.DB,
|
||||||
|
|
||||||
|
OnConnect: o.OnConnect,
|
||||||
MaxRetries: o.MaxRetries,
|
MaxRetries: o.MaxRetries,
|
||||||
Password: o.Password,
|
Password: o.Password,
|
||||||
DialTimeout: o.DialTimeout,
|
DialTimeout: o.DialTimeout,
|
||||||
|
|
Loading…
Reference in New Issue