Skip to content

Commit

Permalink
fix: update grpcserver.go (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixKuhnAnsys authored Jun 19, 2024
1 parent bd482d9 commit f5ef9c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/grpcserver/grpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ func convertStringToGivenType(value string, goType string) (output interface{},
if value == "" {
value = "0"
}
return strconv.ParseFloat(value, 32)
valueFloat64, err := strconv.ParseFloat(value, 32)
if err != nil {
return nil, err
}
return float32(valueFloat64), nil
case "float64":
if value == "" {
value = "0"
Expand All @@ -262,7 +266,11 @@ func convertStringToGivenType(value string, goType string) (output interface{},
if value == "" {
value = "0"
}
return strconv.ParseUint(value, 10, 32)
valueUint64, err := strconv.ParseUint(value, 10, 32)
if err != nil {
return nil, err
}
return uint32(valueUint64), nil
case "bool":
if value == "" {
value = "false"
Expand Down

0 comments on commit f5ef9c7

Please sign in to comment.