summaryrefslogtreecommitdiffstats
path: root/pkg/flatten/flatten.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/flatten/flatten.go')
-rw-r--r--pkg/flatten/flatten.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/pkg/flatten/flatten.go b/pkg/flatten/flatten.go
index 94a6e7e..698eff1 100644
--- a/pkg/flatten/flatten.go
+++ b/pkg/flatten/flatten.go
@@ -1,7 +1,6 @@
package flatten
import (
- "database/sql"
"fmt"
"github.com/icinga/icingadb/pkg/types"
"strconv"
@@ -32,12 +31,12 @@ func Flatten(value interface{}, prefix string) map[string]types.String {
for i, v := range value {
flatten(key+"["+strconv.Itoa(i)+"]", v)
}
+ case nil:
+ flattened[key] = types.MakeString("null")
+ case float64:
+ flattened[key] = types.MakeString(strconv.FormatFloat(value, 'f', -1, 64))
default:
- val := "null"
- if value != nil {
- val = fmt.Sprintf("%v", value)
- }
- flattened[key] = types.String{NullString: sql.NullString{String: val, Valid: true}}
+ flattened[key] = types.MakeString(fmt.Sprintf("%v", value))
}
}