forked from centrifugal/centrifuge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.go
49 lines (40 loc) · 1.42 KB
/
options.go
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package centrifuge
// PublishOptions define some fields to alter behaviour of Publish operation.
type PublishOptions struct {
// SkipHistory allows to prevent saving specific Publication to channel history.
SkipHistory bool
}
// PublishOption is a type to represent various Publish options.
type PublishOption func(*PublishOptions)
// SkipHistory allows to set SkipHistory to true.
func SkipHistory() PublishOption {
return func(opts *PublishOptions) {
opts.SkipHistory = true
}
}
// UnsubscribeOptions define some fields to alter behaviour of Unsubscribe operation.
type UnsubscribeOptions struct {
// Resubscribe allows to set resubscribe protocol flag.
Resubscribe bool
}
// UnsubscribeOption is a type to represent various Unsubscribe options.
type UnsubscribeOption func(*UnsubscribeOptions)
// WithResubscribe allows to set Resubscribe flag to true.
func WithResubscribe() UnsubscribeOption {
return func(opts *UnsubscribeOptions) {
opts.Resubscribe = true
}
}
// DisconnectOptions define some fields to alter behaviour of Disconnect operation.
type DisconnectOptions struct {
// Reconnect allows to set reconnect flag.
Reconnect bool
}
// DisconnectOption is a type to represent various Unsubscribe options.
type DisconnectOption func(options *DisconnectOptions)
// WithReconnect allows to set Reconnect flag to true.
func WithReconnect() DisconnectOption {
return func(opts *DisconnectOptions) {
opts.Reconnect = true
}
}