config

package
v0.0.0-...-183ed1b Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Viper *viper.Viper

Viper Viper 库实例

Functions

func Add

func Add(name string, configuration map[string]interface{})

Add 新增配置项

func Env

func Env(envName string, defaultValue ...interface{}) interface{}

Env 读取环境变量,支持默认值

func Get

func Get(path string, defaultValue ...interface{}) interface{}

Get 获取配置项,允许使用点式获取,如:app.name

func GetBool

func GetBool(path string, defaultValue ...interface{}) bool

GetBool 获取 Bool 类型的配置信息

func GetInt

func GetInt(path string, defaultValue ...interface{}) int

GetInt 获取 Int 类型的配置信息

func GetInt64

func GetInt64(path string, defaultValue ...interface{}) int64

GetInt64 获取 Int64 类型的配置信息

func GetString

func GetString(path string, defaultValue ...interface{}) string

GetString 获取 String 类型的配置信息

func GetUint

func GetUint(path string, defaultValue ...interface{}) uint

GetUint 获取 Uint 类型的配置信息

Types

type StrMap

type StrMap map[string]interface{}

StrMap 简写 —— map[string]interface{}

Jump to

Keyboard shortcuts

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