2
0
mirror of https://github.com/edouardparis/lntop synced 2024-11-16 00:12:44 +00:00
lntop/network/options/channels.go
2019-04-09 10:08:43 +02:00

38 lines
753 B
Go

package options
type Channel func(*ChannelOptions)
type ChannelOptions struct {
Active bool
Inactive bool
Public bool
Private bool
Pending bool
}
func WithChannelPending(c *ChannelOptions) { c.Pending = true }
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
}