Skip to content

Commit

Permalink
Support encoding float32/float64
Browse files Browse the repository at this point in the history
closes #1
  • Loading branch information
Jille committed Oct 29, 2024
1 parent 2b86f82 commit 01b8881
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mysqltsv.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ func valueToBytes(v any, cfg *EncoderOptions) ([]byte, error) {
return []byte{'1'}, nil
}
return []byte{'0'}, nil
case float32:
return []byte(strconv.FormatFloat(float64(v), 'f', -1, 32)), nil
case float64:
return []byte(strconv.FormatFloat(v, 'f', -1, 64)), nil
case time.Time:
if cfg != nil && cfg.Location != nil {
v = v.In(cfg.Location)
Expand Down

0 comments on commit 01b8881

Please sign in to comment.