Config
#struct ConfigA set of settings: dotted keys with text values, in the order they were first set.
| Name | Type | Description |
|---|---|---|
m | collections.OrderedMap | The ordered map that keeps the keys and values in order. |
import config
func main:
mut c := config.New()
defer config.Free(c)
config.Set(c, "name", "salam")
config.Set(c, "port", "8080")
config.Set(c, "debug", "yes")
config.Set(c, "ratio", "0.5")
println config.Len(c), config.Has(c, "port"), config.Get(c, "name")
println config.GetInt(c, "port", 80),
config.GetFloat(c, "ratio", 1.0),
config.GetBool(c, "debug", false)
println config.GetOr(c, "host", "localhost")
println config.Remove(c, "ratio"), config.Keys(c)
end4 true salam 8080 0.5 true localhost true ["name", "port", "debug"]