envconf/datatype.go
2021-03-23 12:57:09 +01:00

24 lines
518 B
Go

package envconf
type DataType int
const (
TypeNone DataType = iota
TypeInt DataType = iota
TypeDuration DataType = iota
TypeString DataType = iota
TypeBool DataType = iota
)
func (dtype DataType) String()(string) {
types := make(map[DataType]string)
types[TypeNone] = "none"
types[TypeInt] = "int"
types[TypeDuration] = "duration"
types[TypeString] = "string"
types[TypeBool] = "bool"
str, ok := types[dtype]
if ok {
return str
}
return "invalid"
}