viper

package
v1.0.1006 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Viper

type Viper struct {
	adapter.Adapter
	// contains filtered or unexported fields
}

*

  • Viper 适配器 *
  • @create 2021-9-25
  • @author deatil

func New

func New() *Viper

构造函数

func (*Viper) AutomaticEnv

func (this *Viper) AutomaticEnv()

环境变量

func (*Viper) Get

func (this *Viper) Get(keyName string) any

Get 一个原始值

func (*Viper) GetBool

func (this *Viper) GetBool(keyName string) bool

GetBool

func (*Viper) GetDuration

func (this *Viper) GetDuration(keyName string) time.Duration

GetDuration

func (*Viper) GetFloat64

func (this *Viper) GetFloat64(keyName string) float64

float64

func (*Viper) GetInt

func (this *Viper) GetInt(keyName string) int

GetInt

func (*Viper) GetInt32

func (this *Viper) GetInt32(keyName string) int32

GetInt32

func (*Viper) GetInt64

func (this *Viper) GetInt64(keyName string) int64

GetInt64

func (*Viper) GetIntSlice

func (this *Viper) GetIntSlice(keyName string) []int

GetIntSlice

func (*Viper) GetSizeInBytes

func (this *Viper) GetSizeInBytes(keyName string) uint

GetSizeInBytes, 暂未使用

func (*Viper) GetString

func (this *Viper) GetString(keyName string) string

GetString

func (*Viper) GetStringMap

func (this *Viper) GetStringMap(keyName string) map[string]any

GetStringMap

func (*Viper) GetStringMapString

func (this *Viper) GetStringMapString(keyName string) map[string]string

GetStringMapString

func (*Viper) GetStringMapStringSlice

func (this *Viper) GetStringMapStringSlice(keyName string) map[string][]string

GetStringMapStringSlice

func (*Viper) GetStringSlice

func (this *Viper) GetStringSlice(keyName string) []string

GetStringSlice

func (*Viper) GetTime

func (this *Viper) GetTime(keyName string) time.Time

GetTime

func (*Viper) GetUint

func (this *Viper) GetUint(keyName string) uint

GetUint

func (*Viper) GetUint32

func (this *Viper) GetUint32(keyName string) uint32

GetUint32

func (*Viper) GetUint64

func (this *Viper) GetUint64(keyName string) uint64

GetUint64

func (*Viper) GetViper

func (this *Viper) GetViper() *viper.Viper

获取

func (*Viper) IsSet

func (this *Viper) IsSet(keyName string) bool

是否设置

func (*Viper) OnConfigChange

func (this *Viper) OnConfigChange(f func(string))

事件

func (*Viper) Set

func (this *Viper) Set(keyName string, value any)

设置

func (*Viper) SetDefault

func (this *Viper) SetDefault(keyName string, value any)

设置默认值

func (*Viper) SetEnvPrefix

func (this *Viper) SetEnvPrefix(prefix string)

环境变量前缀

func (*Viper) WithBytes added in v1.0.1003

func (this *Viper) WithBytes(data []byte, typ string)

要读取的数据

func (*Viper) WithFile

func (this *Viper) WithFile(fileName ...string)

要读取的文件

func (*Viper) WithPath

func (this *Viper) WithPath(path string)

设置文件夹

Jump to

Keyboard shortcuts

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