fix (#533): json conversion issue

This commit is contained in:
Mickael Kerjean 2023-03-31 08:20:51 +11:00
parent aefe20bd26
commit 86dde05507

View file

@ -3,6 +3,7 @@ package common
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"strconv" "strconv"
@ -58,8 +59,9 @@ func NewStringpFromInterface(val interface{}) *string {
func NewStringFromInterface(val interface{}) string { func NewStringFromInterface(val interface{}) string {
switch val.(type) { switch val.(type) {
case string: case string:
v := val.(string) return val.(string)
return v case float64:
return fmt.Sprintf("%d", int64(val.(float64)))
default: default:
return "" return ""
} }