2019-03-15 16:02:16 +00:00
|
|
|
package options
|
|
|
|
|
|
|
|
type Channel func(*ChannelOptions)
|
|
|
|
|
|
|
|
type ChannelOptions struct {
|
|
|
|
Active bool
|
|
|
|
Inactive bool
|
|
|
|
Public bool
|
|
|
|
Private bool
|
2019-04-08 07:48:57 +00:00
|
|
|
Pending bool
|
|
|
|
}
|
|
|
|
|
2019-04-09 08:08:43 +00:00
|
|
|
func WithChannelPending(c *ChannelOptions) { c.Pending = true }
|
2019-03-15 16:02:16 +00:00
|
|
|
|
|
|
|
func WithChannelPublic(v bool) Channel {
|
|
|
|
return func(c *ChannelOptions) { c.Public = v }
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithChannelPrivate(v bool) Channel {
|
|
|
|
return func(c *ChannelOptions) { c.Private = v }
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithChannelActive(v bool) Channel {
|
|
|
|
return func(c *ChannelOptions) { c.Active = v }
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithChannelInactive(v bool) Channel {
|
|
|
|
return func(c *ChannelOptions) { c.Inactive = v }
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewChannelOptions(options ...Channel) ChannelOptions {
|
|
|
|
opts := ChannelOptions{}
|
|
|
|
for i := range options {
|
|
|
|
options[i](&opts)
|
|
|
|
}
|
|
|
|
return opts
|
|
|
|
}
|