Skip to content

Commit

Permalink
Flatten(): render even large numbers as-is, not using scientific nota…
Browse files Browse the repository at this point in the history
…tion

E.g. 2000000000000000000 (explicitly), not 2e+18 (as with fmt.Sprintf("%v")).
  • Loading branch information
Al2Klimov committed Oct 10, 2023
1 parent 57f4f78 commit 4a10a66
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/flatten/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ func Flatten(value interface{}, prefix string) map[string]types.String {
}
default:
val := "null"
if value != nil {
switch v := value.(type) {
case nil:
case float64:
val = strconv.FormatFloat(v, 'f', -1, 64)
default:
val = fmt.Sprintf("%v", value)
}

flattened[key] = types.String{NullString: sql.NullString{String: val, Valid: true}}
}
}
Expand Down

0 comments on commit 4a10a66

Please sign in to comment.