-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathoptions.go
More file actions
32 lines (27 loc) · 832 Bytes
/
options.go
File metadata and controls
32 lines (27 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package redis
// Option customizes client configuration.
type Option func(*cfg)
// WithMessageEncodeFunc overrides the encoder used by SendData and SetData.
func WithMessageEncodeFunc(f TEncodeFunc) Option {
return func(c *cfg) {
c.messageEncodeFunc = f
}
}
// WithMessageDecodeFunc overrides the decoder used by ReceiveData and GetData.
func WithMessageDecodeFunc(f TDecodeFunc) Option {
return func(c *cfg) {
c.messageDecodeFunc = f
}
}
// WithSubscrChannels sets channels subscribed at client creation time.
func WithSubscrChannels(channels ...string) Option {
return func(c *cfg) {
c.subChannels = channels
}
}
// WithSubscrChannelOptions sets subscription channel options for go-redis Pub/Sub.
func WithSubscrChannelOptions(opts ...ChannelOption) Option {
return func(c *cfg) {
c.subChannelOpts = opts
}
}