Documentation ¶
Index ¶
- Variables
- func RegisterOption(opt Option, name string, domains []string)
- func RegisterStructuredOptions(opts interface{}, domains []string)
- type AnyOption
- type BaseOption
- type BoolOption
- type Int32Option
- type IntOption
- type Option
- type OptionChangeHook
- type OptionValues
- type Options
- type ReadOnlyOptions
- type StringOption
- type TimeDurationOption
- type Uint16Option
- type Uint32Option
- type Uint8Option
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidOptionValue = errors.New("invalid option value") ErrUnsupportedOption = errors.New("unsupported option") ErrOptionNotFound = errors.New("option not found") )
errors
Functions ¶
func RegisterOption ¶
RegisterOption register option
func RegisterStructuredOptions ¶
func RegisterStructuredOptions(opts interface{}, domains []string)
RegisterStructuredOptions register structured options
Types ¶
type BaseOption ¶
type BaseOption struct {
// contains filtered or unexported fields
}
BaseOption is the base of specific options
func (*BaseOption) DefaultValue ¶
func (o *BaseOption) DefaultValue() interface{}
DefaultValue returns the default option value.
func (*BaseOption) String ¶
func (o *BaseOption) String() string
type BoolOption ¶
BoolOption is option with bool value.
type Int32Option ¶
type Int32Option interface { Option Value(val interface{}) int32 ValueFrom(optss ...Options) int32 }
Int32Option is option with int32 value.
func NewInt32Option ¶
func NewInt32Option(val int32) Int32Option
NewInt32Option create an int32 option
type Option ¶
type Option interface { String() string DefaultValue() interface{} Validate(val interface{}) (newVal interface{}, err error) Parse(s string) (val interface{}, err error) }
Option is an option item.
func ParseOption ¶
ParseOption parse Option from string.
type OptionChangeHook ¶
OptionChangeHook is called when set an option value.
type Options ¶
type Options interface { SetOption(opt Option, val interface{}) (err error) SetOptionIfNotExists(opt Option, val interface{}) (err error) ReadOnlyOptions AddOptionChangeHook(hook OptionChangeHook) Options }
Options is option set.
func NewOptionsWithAccepts ¶
NewOptionsWithAccepts create an option set with accepts.
func NewOptionsWithDownStreamsAndAccepts ¶
NewOptionsWithDownStreamsAndAccepts create an option set with down stream and accepts.
func NewOptionsWithValues ¶
func NewOptionsWithValues(ovs OptionValues) Options
NewOptionsWithValues create an option set with option values.
func NewOptionsWithValuesAndSubs ¶
func NewOptionsWithValuesAndSubs(ovs OptionValues, subs ...Options) Options
NewOptionsWithValuesAndSubs create an option set with values and sub options
type ReadOnlyOptions ¶
type ReadOnlyOptions interface { GetOption(opt Option) (val interface{}, ok bool) GetOptionDefault(opt Option) interface{} OptionValues() OptionValues }
ReadOnlyOptions is options set read only.
type StringOption ¶
type StringOption interface { Option Value(val interface{}) string ValueFrom(optss ...Options) string }
StringOption is option with string value.
func NewStringOption ¶
func NewStringOption(val string) StringOption
NewStringOption create a string option
type TimeDurationOption ¶
type TimeDurationOption interface { Option Value(val interface{}) time.Duration ValueFrom(optss ...Options) time.Duration }
TimeDurationOption is option with time duration value.
func NewTimeDurationOption ¶
func NewTimeDurationOption(name time.Duration) TimeDurationOption
NewTimeDurationOption create a time duration option
type Uint16Option ¶
type Uint16Option interface { Option Value(val interface{}) uint16 ValueFrom(optss ...Options) uint16 }
Uint16Option is option with uint16 value.
func NewUint16Option ¶
func NewUint16Option(val uint16) Uint16Option
NewUint16Option create an uint16 option
type Uint32Option ¶
type Uint32Option interface { Option Value(val interface{}) uint32 ValueFrom(optss ...Options) uint32 }
Uint32Option is option with uint32 value.
func NewUint32Option ¶
func NewUint32Option(val uint32) Uint32Option
NewUint32Option create an uint32 option
type Uint8Option ¶
type Uint8Option interface { Option Value(val interface{}) uint8 ValueFrom(optss ...Options) uint8 }
Uint8Option is option with uint8 value.
func NewUint8Option ¶
func NewUint8Option(val uint8) Uint8Option
NewUint8Option create an uint8 option