mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Flatten: Fix keys
This commit is contained in:
parent
52e5eb774e
commit
e71833defb
1 changed files with 2 additions and 4 deletions
|
|
@ -13,13 +13,11 @@ func Flatten(value interface{}, prefix string) map[string]interface{} {
|
|||
switch value := value.(type) {
|
||||
case map[string]interface{}:
|
||||
for k, v := range value {
|
||||
key += "." + k
|
||||
flatten(key, v)
|
||||
flatten(key+"."+k, v)
|
||||
}
|
||||
case []interface{}:
|
||||
for i, v := range value {
|
||||
key += "[" + strconv.Itoa(i) + "]"
|
||||
flatten(key, v)
|
||||
flatten(key+"["+strconv.Itoa(i)+"]", v)
|
||||
}
|
||||
default:
|
||||
flattened[key] = value
|
||||
|
|
|
|||
Loading…
Reference in a new issue