Documentation
¶
Index ¶
- func SetCfgSecKeyGetter(p CfgSecKeyGetter)
- func SetDynGetter(p DynKeyGetter)
- type CfgSecKey
- type CfgSecKeyGetter
- type DynKeyGetter
- type Option
- func (opt *Option[T]) DefaultValue() T
- func (opt *Option[T]) DynKey() string
- func (opt *Option[T]) GetDefaultValue() any
- func (opt *Option[T]) HasValue(ctx context.Context) bool
- func (opt *Option[T]) Value(ctx context.Context) (v T)
- func (opt *Option[T]) ValueRevision(ctx context.Context) (v T, rev int, has bool)
- func (opt *Option[T]) WithDefaultFunc(f func() T) *Option[T]
- func (opt *Option[T]) WithDefaultSimple(def T) *Option[T]
- func (opt *Option[T]) WithEmptyAsDefault() *Option[T]
- func (opt *Option[T]) WithFileConfig(cfgSecKey CfgSecKey) *Option[T]
- type OptionInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetCfgSecKeyGetter ¶
func SetCfgSecKeyGetter(p CfgSecKeyGetter)
func SetDynGetter ¶
func SetDynGetter(p DynKeyGetter)
Types ¶
type CfgSecKeyGetter ¶
func GetCfgSecKeyGetter ¶
func GetCfgSecKeyGetter() CfgSecKeyGetter
type DynKeyGetter ¶
type DynKeyGetter interface {
GetValue(ctx context.Context, key string) (v string, has bool)
GetRevision(ctx context.Context) int
InvalidateCache()
}
func GetDynGetter ¶
func GetDynGetter() DynKeyGetter
type Option ¶ added in v1.26.0
type Option[T any] struct { // contains filtered or unexported fields }
func (*Option[T]) DefaultValue ¶ added in v1.26.0
func (opt *Option[T]) DefaultValue() T
func (*Option[T]) GetDefaultValue ¶ added in v1.26.0
func (*Option[T]) ValueRevision ¶ added in v1.26.0
func (*Option[T]) WithDefaultFunc ¶ added in v1.26.0
WithDefaultFunc sets the default value with a function The "def" value might be changed during runtime (e.g.: Unmarshal with default), so it shouldn't use the same pointer or slice
func (*Option[T]) WithDefaultSimple ¶ added in v1.26.0
func (*Option[T]) WithEmptyAsDefault ¶ added in v1.26.0
func (*Option[T]) WithFileConfig ¶ added in v1.26.0
type OptionInterface ¶ added in v1.26.0
type OptionInterface interface {
GetDefaultValue() any
}
OptionInterface is used to overcome Golang's generic interface limitation
func GetConfigOption ¶ added in v1.26.0
func GetConfigOption(dynKey string) OptionInterface
Click to show internal directories.
Click to hide internal directories.