From 1b1fc80e204776fb2b8931884146ebd0979766cb Mon Sep 17 00:00:00 2001 From: "Olve S. Hansen" Date: Mon, 16 Apr 2018 09:15:52 +0200 Subject: [PATCH] Added OnConnect callback to UniversalOptions (#747) * Added OnConnect callback to UniversalOptions --- commands_test.go | 2 +- universal.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/commands_test.go b/commands_test.go index 156b1221..595581fc 100644 --- a/commands_test.go +++ b/commands_test.go @@ -219,7 +219,7 @@ var _ = Describe("Commands", func() { It("Should Command", func() { cmds, err := client.Command().Result() Expect(err).NotTo(HaveOccurred()) - Expect(len(cmds)).To(BeNumerically("~", 180, 10)) + Expect(len(cmds)).To(BeNumerically("~", 185, 10)) cmd := cmds["mget"] Expect(cmd.Name).To(Equal("mget")) diff --git a/universal.go b/universal.go index fde3c415..28df2c79 100644 --- a/universal.go +++ b/universal.go @@ -27,6 +27,7 @@ type UniversalOptions struct { // Common options + OnConnect func(*Conn) error MaxRetries int Password string DialTimeout time.Duration @@ -49,6 +50,7 @@ func (o *UniversalOptions) cluster() *ClusterOptions { RouteByLatency: o.RouteByLatency, ReadOnly: o.ReadOnly, + OnConnect: o.OnConnect, MaxRetries: o.MaxRetries, Password: o.Password, DialTimeout: o.DialTimeout, @@ -71,6 +73,7 @@ func (o *UniversalOptions) failover() *FailoverOptions { MasterName: o.MasterName, DB: o.DB, + OnConnect: o.OnConnect, MaxRetries: o.MaxRetries, Password: o.Password, DialTimeout: o.DialTimeout, @@ -93,6 +96,7 @@ func (o *UniversalOptions) simple() *Options { Addr: addr, DB: o.DB, + OnConnect: o.OnConnect, MaxRetries: o.MaxRetries, Password: o.Password, DialTimeout: o.DialTimeout,