config

package
v0.0.0-...-06d884a Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CfgFile string

CfgFile 配置文件路径,允许在初始化前,由外部包赋值

Functions

func AllKeys

func AllKeys() []string

AllKeys returns all keys holding a value, regardless of where they are set. Nested keys are returned with a v.keyDelim (= ".") separator

func AllSettings

func AllSettings() map[string]interface{}

AllSettings merges all settings and returns them as a map[string]interface{}.

func Get

func Get(k string) interface{}

Get can retrieve any value given the key to use.

func GetBool

func GetBool(k string) bool

GetBool returns the value associated with the key as a boolean.

func GetDuration

func GetDuration(key string) time.Duration

GetDuration returns the value associated with the key as a duration.

func GetFloat64

func GetFloat64(key string) float64

GetFloat64 returns the value associated with the key as a float64.

func GetInt

func GetInt(key string) int

GetInt returns the value associated with the key as an integer.

func GetInt32

func GetInt32(key string) int32

GetInt32 returns the value associated with the key as an integer.

func GetInt64

func GetInt64(key string) int64

GetInt64 returns the value associated with the key as an integer.

func GetSizeInBytes

func GetSizeInBytes(key string) uint

GetSizeInBytes returns the size of the value associated with the given key in bytes.

func GetString

func GetString(key string) string

GetString returns the value associated with the key as a string.

func GetStringMap

func GetStringMap(key string) map[string]interface{}

GetStringMap returns the value associated with the key as a map of interfaces.

func GetStringMapString

func GetStringMapString(key string) map[string]string

GetStringMapString returns the value associated with the key as a map of strings.

func GetStringMapStringSlice

func GetStringMapStringSlice(key string) map[string][]string

GetStringMapStringSlice returns the value associated with the key as a map to a slice of strings.

func GetStringSlice

func GetStringSlice(key string) []string

GetStringSlice returns the value associated with the key as a slice of strings.

func GetTime

func GetTime(key string) time.Time

GetTime returns the value associated with the key as time.

func GetUint

func GetUint(key string) uint

GetUint returns the value associated with the key as an unsigned integer.

func GetUint32

func GetUint32(key string) uint32

GetUint32 returns the value associated with the key as an unsigned integer.

func GetUint64

func GetUint64(key string) uint64

GetUint64 returns the value associated with the key as an unsigned integer.

func Init

func Init()

Init auto load config

func IsSet

func IsSet(key string) bool

IsSet checks to see if the key has been set in any of the data locations. IsSet is case-insensitive for a key.

func RegisterChangeEvent

func RegisterChangeEvent(f func(e fsnotify.Event))

RegisterChangeEvent 注册配置变更事件

Types

This section is empty.

Jump to

Keyboard shortcuts

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