mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-06 18:36:36 +08:00
34 lines
454 B
Go
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
|
|
}
|