Files
2020-04-26 11:01:26 +08:00

36 lines
648 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* @Author : huangzj
* @Time : 2020/4/17 14:41
* @Description
*/
package util
import (
"gopkg.in/ini.v1"
"strconv"
)
func GenerateConfigBool(key string, real *bool, section *ini.Section) {
if section.Key(key).String() != "false" {
*real = true
return
}
*real = false
}
func GenerateConfig(key string, real string, section *ini.Section) {
if section.Key(key).String() != "" {
real = section.Key(key).String()
}
}
func GenerateConfigInt(key string, real int, section *ini.Section) {
if section.Key(key).String() != "" {
value, err := strconv.Atoi(section.Key(key).String())
if err == nil {
real = value
}
}
}