viper

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamEmpty liberr.CodeError = iota + liberr.MinPkgViper
	ErrorParamMissing
	ErrorHomePathNotFound
	ErrorBasePathNotFound
	ErrorRemoteProvider
	ErrorRemoteProviderSecure
	ErrorRemoteProviderRead
	ErrorRemoteProviderMarshall
	ErrorConfigRead
	ErrorConfigReadDefault
	ErrorConfigIsDefault
)
View Source
const (
	RemoteETCD = "etcd"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncConfigGet added in v1.10.0

type FuncConfigGet func(key string, model interface{}) liberr.Error

type FuncSPFViper added in v1.10.0

type FuncSPFViper func() *spfvpr.Viper

type FuncViper added in v1.10.0

type FuncViper func() Viper

type Viper

type Viper interface {
	SetRemoteProvider(provider string)
	SetRemoteEndpoint(endpoint string)
	SetRemotePath(path string)
	SetRemoteSecureKey(key string)
	SetRemoteModel(model interface{})
	SetRemoteReloadFunc(fct func())

	SetHomeBaseName(base string)
	SetEnvVarsPrefix(prefix string)
	SetDefaultConfig(fct func() io.Reader)
	SetConfigFile(fileConfig string) liberr.Error

	Config(logLevelRemoteKO, logLevelRemoteOK loglvl.Level) liberr.Error
	Viper() *spfvpr.Viper
	WatchFS(logLevelFSInfo loglvl.Level)
	Unset(key ...string) error

	HookRegister(hook libmap.DecodeHookFunc)
	HookReset()

	UnmarshalKey(key string, rawVal interface{}) error
	Unmarshal(rawVal interface{}) error
	UnmarshalExact(rawVal interface{}) error

	GetBool(key string) bool
	GetString(key string) string
	GetInt(key string) int
	GetInt32(key string) int32
	GetInt64(key string) int64
	GetUint(key string) uint
	GetUint16(key string) uint16
	GetUint32(key string) uint32
	GetUint64(key string) uint64
	GetFloat64(key string) float64
	GetTime(key string) time.Time
	GetDuration(key string) time.Duration
	GetIntSlice(key string) []int
	GetStringSlice(key string) []string
	GetStringMap(key string) map[string]any
	GetStringMapString(key string) map[string]string
	GetStringMapStringSlice(key string) map[string][]string
}

func New

func New(ctx libctx.FuncContext, log liblog.FuncLog) Viper

Jump to

Keyboard shortcuts

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