Skip to content

Commit

Permalink
enhance: data/table: better handle int conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
grokify committed Jun 14, 2021
1 parent 3563447 commit 1948603
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion data/table/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ func (tbl *Table) FormatterFunc() func(val string, colIdx uint) (interface{}, er
case FormatInt:
intVal, err := strconv.Atoi(val)
if err != nil {
return val, err
floatVal, err2 := strconv.ParseFloat(val, 64)
if err2 != nil {
return val, err
} else {
return int(floatVal), nil
}
}
return intVal, nil
case FormatTime:
Expand Down

0 comments on commit 1948603

Please sign in to comment.