Configuration file syntax and parsing for golang
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
525 B

package config
type ConfigType int
const (
SECTION ConfigType = iota
INTEGER
BOOLEAN
FLOAT
STRING
NULL
)
var configTypes = [...]string{
SECTION: "SECTION",
BOOLEAN: "BOOLEAN",
INTEGER: "INTEGER",
FLOAT: "FLOAT",
STRING: "STRING",
NULL: "NULL",
}
func (this ConfigType) String() string {
s := ""
if 0 <= this && this < ConfigType(len(configTypes)) {
s = configTypes[this]
}
if s == "" {
s = "UNKNOWN"
}
return s
}
type ConfigValue interface {
GetType() ConfigType
GetValue() interface{}
}