config

package
v0.0.0-...-26e86c7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	Sub(path string) Config
	Get(path string) Value
	Set(path string, val interface{}) error
	Scan(out interface{}) error
	Write() error
	OnChange(callback OnChangedFunc)
}

type OnChangedFunc

type OnChangedFunc func()

OnChangedFunc for calling on config change callback

type Value

type Value interface {
	Bool(def ...bool) bool
	String(def ...string) string
	Float64(def ...float64) float64
	Duration(def ...time.Duration) time.Duration
	StringSlice(def ...[]string) []string
	StringMap(def ...map[string]interface{}) map[string]interface{}
	StringMapString(def ...map[string]string) map[string]string
	Scan(val interface{}) error
}

Value represent value of config fields

type Viper

type Viper struct {
	// contains filtered or unexported fields
}

func NewViper

func NewViper(path string, opts ...ViperOptions) *Viper

func (*Viper) Get

func (c *Viper) Get(path string) Value

func (*Viper) OnChange

func (c *Viper) OnChange(callback OnChangedFunc)

func (*Viper) Scan

func (c *Viper) Scan(out interface{}) error

func (*Viper) Set

func (c *Viper) Set(path string, val interface{}) error

func (*Viper) Sub

func (c *Viper) Sub(path string) Config

func (*Viper) Write

func (c *Viper) Write() error

type ViperOptions

type ViperOptions interface {
	Configure(v *Viper)
}

func ViperPaths

func ViperPaths(paths ...string) ViperOptions

func ViperStandalone

func ViperStandalone() ViperOptions

type ViperOptionsFunc

type ViperOptionsFunc func(v *Viper)

func (ViperOptionsFunc) Configure

func (f ViperOptionsFunc) Configure(v *Viper)

Jump to

Keyboard shortcuts

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