viper

package
v0.0.0-...-75a017b Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 设置配置文件改变时的处理函数
	OnConfigChange = viper.OnConfigChange
	// starts watching a config file for changes
	// 不会阻塞
	WatchConfig = viper.WatchConfig
)

Functions

func Unmarshal

func Unmarshal(in string, s any) error

Unmarshal 加载配置文件到 s s 是结构体指针,标签用 mapstructure

func UnmarshalB

func UnmarshalB(b []byte, t string, s any) error

UnmarshalB 加载配置字节串到结构体 自动加载环境变量 t是格式类型 yaml s是结构体指针,标签用mapstructure

func UnmarshalEnv

func UnmarshalEnv(f, t string, s any) error

UnmarshalEnv 加载配置文件到结构体 自动加载环境变量 f是配置文件路径 t是文件类型 yaml s是结构体指针,标签用mapstructure

func UnmarshalWatch

func UnmarshalWatch(in string, s any) error

UnmarshalWatch 加载配置文件到 s,并监听文件变动,同步到 s s 是结构体指针,标签用 mapstructure

Types

This section is empty.

Jump to

Keyboard shortcuts

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