conf

package
v0.0.0-...-115e584 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(file string, v interface{}, opts ...Option) error

LoadConfig 从文件file加载配置到v变量,支持json、yaml和yml文件

func LoadConfigFromJsonBytes

func LoadConfigFromJsonBytes(content []byte, v interface{}) error

LoadConfigFromJsonBytes 将json类型的content转换为变量v

func LoadConfigFromYamlBytes

func LoadConfigFromYamlBytes(content []byte, v interface{}) error

LoadConfigFromYamlBytes 将yaml类型的content转换为变量v

func MustLoad

func MustLoad(path string, v interface{}, opts ...Option)

MustLoad 在程序加载的时候就将配置文件的配置加载到变量v,如果出现错误就fast-fail

Types

type Option

type Option func(opt *options)

func UseEnv

func UseEnv() Option

UseEnv 自定义这个配置以使用环境变量功能

Jump to

Keyboard shortcuts

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