conf

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 9 Imported by: 0

README

conf

解析yaml、json、toml配置文件到go struct。


使用示例

    // 方式一:无监听配置文件
	conf := &App{}
	err := Parse("test.yml", conf)

    // 方式二:开启监听配置文件
	conf := &App{}
	fs := []func(){
		func() {
			fmt.Println("监听到配置文件有更新")
		},
	}
	err := Parse("test.yml", conf, fs...)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(configFile string, obj interface{}, fs ...func()) error

Parse 解析配置文件到struct,包括yaml、toml、json等文件,如果fs不为空,开启监听配置文件变化

func Show

func Show(obj interface{}, keywords ...string) string

Show 打印配置信息(去掉敏感信息)

Types

This section is empty.

Jump to

Keyboard shortcuts

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