config

package
v1.26.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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 CfgSecKey

type CfgSecKey struct {
	Sec, Key string
}

type CfgSecKeyGetter

type CfgSecKeyGetter interface {
	GetValue(sec, key string) (v string, has bool)
}

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 NewOption added in v1.26.0

func NewOption[T any](dynKey string) *Option[T]

func (*Option[T]) DefaultValue added in v1.26.0

func (opt *Option[T]) DefaultValue() T

func (*Option[T]) DynKey added in v1.26.0

func (opt *Option[T]) DynKey() string

func (*Option[T]) GetDefaultValue added in v1.26.0

func (opt *Option[T]) GetDefaultValue() any

func (*Option[T]) HasValue added in v1.26.0

func (opt *Option[T]) HasValue(ctx context.Context) bool

func (*Option[T]) Value added in v1.26.0

func (opt *Option[T]) Value(ctx context.Context) (v T)

func (*Option[T]) ValueRevision added in v1.26.0

func (opt *Option[T]) ValueRevision(ctx context.Context) (v T, rev int, has bool)

func (*Option[T]) WithDefaultFunc added in v1.26.0

func (opt *Option[T]) WithDefaultFunc(f func() T) *Option[T]

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 (opt *Option[T]) WithDefaultSimple(def T) *Option[T]

func (*Option[T]) WithEmptyAsDefault added in v1.26.0

func (opt *Option[T]) WithEmptyAsDefault() *Option[T]

func (*Option[T]) WithFileConfig added in v1.26.0

func (opt *Option[T]) WithFileConfig(cfgSecKey CfgSecKey) *Option[T]

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL