@@ -49,7 +49,8 @@ type UniversalOptions struct {
49
49
MasterName string
50
50
}
51
51
52
- func (o * UniversalOptions ) cluster () * ClusterOptions {
52
+ // Cluster returns cluster options created from the universal options.
53
+ func (o * UniversalOptions ) Cluster () * ClusterOptions {
53
54
if len (o .Addrs ) == 0 {
54
55
o .Addrs = []string {"127.0.0.1:6379" }
55
56
}
@@ -84,7 +85,8 @@ func (o *UniversalOptions) cluster() *ClusterOptions {
84
85
}
85
86
}
86
87
87
- func (o * UniversalOptions ) failover () * FailoverOptions {
88
+ // Failover returns failover options created from the universal options.
89
+ func (o * UniversalOptions ) Failover () * FailoverOptions {
88
90
if len (o .Addrs ) == 0 {
89
91
o .Addrs = []string {"127.0.0.1:26379" }
90
92
}
@@ -118,7 +120,8 @@ func (o *UniversalOptions) failover() *FailoverOptions {
118
120
}
119
121
}
120
122
121
- func (o * UniversalOptions ) simple () * Options {
123
+ // Simple returns basic options created from the universal options.
124
+ func (o * UniversalOptions ) Simple () * Options {
122
125
addr := "127.0.0.1:6379"
123
126
if len (o .Addrs ) > 0 {
124
127
addr = o .Addrs [0 ]
@@ -183,9 +186,9 @@ var _ UniversalClient = (*Ring)(nil)
183
186
// 3. otherwise, a single-node redis Client will be returned.
184
187
func NewUniversalClient (opts * UniversalOptions ) UniversalClient {
185
188
if opts .MasterName != "" {
186
- return NewFailoverClient (opts .failover ())
189
+ return NewFailoverClient (opts .Failover ())
187
190
} else if len (opts .Addrs ) > 1 {
188
- return NewClusterClient (opts .cluster ())
191
+ return NewClusterClient (opts .Cluster ())
189
192
}
190
- return NewClient (opts .simple ())
193
+ return NewClient (opts .Simple ())
191
194
}
0 commit comments