Documentation ¶
Overview ¶
Package configutil .
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
Container manages multiple config sources with priorities.
func NewConfigContainer ¶
func NewConfigContainer() Container
NewConfigContainer creates an empty Container.
type DefaultConfig ¶
type DefaultConfig interface {
Get(key string, def interface{}) interface{}
}
DefaultConfig provides access to configurations.
func NewDefaultConfig ¶
func NewDefaultConfig(c Config) DefaultConfig
NewDefaultConfig creates a DefaultConfig with the given Config.
type OptionOnce ¶
type OptionOnce struct {
OptMap map[string]struct{}
}
OptionOnce is used to ensure an option is only set once.
func NewOptionOnce ¶
func NewOptionOnce() *OptionOnce
NewOptionOnce creates a new option once instance.
func (*OptionOnce) OnceOrPanic ¶
func (o *OptionOnce) OnceOrPanic()
OnceOrPanic panics if the Option has already been set.
type RichTypeConfig ¶
type RichTypeConfig interface { GetBool(key string) (val bool, ok bool) GetInt(key string) (val int, ok bool) GetString(key string) (val string, ok bool) GetInt64(key string) (val int64, ok bool) GetFloat(key string) (val float64, ok bool) GetDuration(key string) (val time.Duration, ok bool) }
RichTypeConfig provides typed get functions.
func NewRichTypeConfig ¶
func NewRichTypeConfig(c Config) RichTypeConfig
NewRichTypeConfig creates a RichTypeConfig with the given Config.
type RichTypeDefaultConfig ¶
type RichTypeDefaultConfig interface { GetBool(key string, def bool) bool GetInt(key string, def int) int GetString(key string, def string) string GetInt64(key string, def int64) int64 GetFloat(key string, def float64) float64 GetDuration(key string, def time.Duration) time.Duration }
RichTypeDefaultConfig provides typed get functions with default value support.
func NewRichTypeDefaultConfig ¶
func NewRichTypeDefaultConfig(rtc RichTypeConfig) RichTypeDefaultConfig
NewRichTypeDefaultConfig creates a RichTypeDefaultConfig with the given RichTypeConfig.