2024-01-08 20:36:41 +08:00

34 lines
454 B
Go

package option
func NewOption() *Option {
return &Option{}
}
type Option struct {
Enable *bool
Link []string
}
func (o *Option) WithEnable() *Option {
t := true
o.Enable = &t
return o
}
func (o *Option) WithDisable() *Option {
f := false
o.Enable = &f
return o
}
func (o *Option) WithLink(key ...string) *Option {
if len(key) > 0 {
if len(o.Link) == 0 {
o.Link = key
} else {
o.Link = append(o.Link, key...)
}
}
return o
}