2021-03-24 10:51:09 +00:00
|
|
|
package envconf
|
|
|
|
type dataTypeInfo struct {
|
|
|
|
parser func(string,string)(cValue)
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
var tInfo map[DataType]dataTypeInfo
|
|
|
|
func init() {
|
|
|
|
tInfo = make(map[DataType]dataTypeInfo)
|
|
|
|
var intInfo dataTypeInfo
|
|
|
|
var durInfo dataTypeInfo
|
|
|
|
var strInfo dataTypeInfo
|
2021-03-24 14:15:37 +00:00
|
|
|
var dirInfo dataTypeInfo
|
2021-03-24 10:51:09 +00:00
|
|
|
var boolInfo dataTypeInfo
|
|
|
|
|
|
|
|
intInfo.name = "int"
|
|
|
|
durInfo.name = "duration"
|
2021-03-24 14:15:37 +00:00
|
|
|
dirInfo.name = "directory"
|
2021-03-24 10:51:09 +00:00
|
|
|
strInfo.name = "string"
|
|
|
|
boolInfo.name = "bool"
|
|
|
|
|
|
|
|
intInfo.parser = parseInt
|
|
|
|
durInfo.parser = parseDuration
|
2021-03-24 14:15:37 +00:00
|
|
|
dirInfo.parser = parseDirectory
|
2021-03-24 10:51:09 +00:00
|
|
|
strInfo.parser = parseString
|
|
|
|
boolInfo.parser = parseBool
|
|
|
|
|
|
|
|
tInfo[TypeInt] = intInfo
|
|
|
|
tInfo[TypeDuration] = durInfo
|
|
|
|
tInfo[TypeString] = strInfo
|
2021-03-24 14:15:37 +00:00
|
|
|
tInfo[TypeDirectory] = dirInfo
|
2021-03-24 10:51:09 +00:00
|
|
|
tInfo[TypeBool] = boolInfo
|
|
|
|
}
|