Skip to content

Commit

Permalink
Add more types to dataflatten (#782)
Browse files Browse the repository at this point in the history
Add support for `uint8`, `uint16`, `int8`, and `int16` to dataflatten
  • Loading branch information
directionless committed Dec 28, 2021
1 parent 503d79f commit afecf73
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/dataflatten/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ func stringify(data interface{}) (string, error) {
return s, nil
}
return base64.StdEncoding.EncodeToString(v), nil
case uint8:
return strconv.FormatUint(uint64(v), 10), nil
case uint16:
return strconv.FormatUint(uint64(v), 10), nil
case uint32:
return strconv.FormatUint(uint64(v), 10), nil
case uint64:
Expand All @@ -470,6 +474,10 @@ func stringify(data interface{}) (string, error) {
return strconv.FormatFloat(v, 'f', -1, 64), nil
case int:
return strconv.Itoa(v), nil
case int8:
return strconv.FormatInt(int64(v), 10), nil
case int16:
return strconv.FormatInt(int64(v), 10), nil
case int32:
return strconv.FormatInt(int64(v), 10), nil
case int64:
Expand Down

0 comments on commit afecf73

Please sign in to comment.