Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func InitConfig ¶
func JsonLoader ¶
func YamlLoader ¶
Types ¶
type FConfigLoader ¶
FConfigLoader 加载器,将配置文件数据反序列化成 interface{} 并返回
type IConfig ¶
type IConfig interface { // GetString retrieve the string value for the // specified key from the configuration file. GetString(k string) (r string, err error) // GetStringDefault retrieve the string value for the // specified key from the configuration file, // or return the default value if it doesn't exist. GetStringDefault(k, d string) string // GetInt Retrieve the integer value for the // specified key from the configuration file. GetInt(k string) (r int, err error) // GetIntDefault Retrieve the integer value for the // specified key from the configuration file, // or return the default value if it doesn't exist. GetIntDefault(k string, d int) int // GetInt64 Retrieve the int64 value for the specified // key from the configuration file. GetInt64(k string) (r int64, err error) // GetInt64Default Retrieve the int64 value for the // specified key from the configuration file, // or return the default value if it doesn't exist. GetInt64Default(k string, d int64) int64 // GetFloat Retrieve the float value for the specified // key from the configuration file. GetFloat(k string) (r float64, err error) // GetFloatDefault Retrieve the float value for the // specified key from the configuration file, // or return the default value if it doesn't exist. GetFloatDefault(k string, d float64) float64 // GetIntFormat If the value for the specified key // in the configuration file is of type float64, int64, or int, // force conversion to int and return. GetIntFormat(k string) (r int, err error) // GetIntFormatDefault similar to GetIntFormat, // except that if the key does not exist or the conversion fails, // the default value is returned GetIntFormatDefault(k string, d int) (r int) // GetFloatFormat If the value for the specified key in the // configuration file is of type float64, int64, or int, // force conversion to float64 and return. GetFloatFormat(k string) (r float64, err error) // GetFloatFormatDefault similar to GetFloatFormat, // except that if the key does not exist or the conversion fails, // the default value is returned GetFloatFormatDefault(k string, d float64) (r float64) // GetBool Retrieve the boolean value for the // specified key from the configuration file. GetBool(k string) (r bool, err error) // GetBoolDefault Retrieve the boolean value for the // specified key from the configuration file, // or return the default value if it doesn't exist. GetBoolDefault(k string, d bool) bool // GetVal Read the value corresponding to key from //the configuration file and deserialize it to the // parameter to,to should be a pointer GetVal(k string, to any) (r any, err error) // GetStrings Read the string list for the // specified key from the configuration file. GetStrings(k string) (r []string, err error) // GetIntegers Read the integers list for the // specified key from the configuration file. GetIntegers(k string) (r []int64, err error) // GetFloats Read the float list for the // specified key from the configuration file. GetFloats(k string) (r []float64, err error) // GetBooleans Read the boolean list for the // specified key from the configuration file. GetBooleans(k string) (r []bool, err error) // GetMap Read the mapt for the // specified key from the configuration file. GetMap(k string) (r map[string]any, err error) }
IConfig interface defines a set of generic methods for getting values from configuration files.
Click to show internal directories.
Click to hide internal directories.