diff --git a/client_test.go b/client_test.go index 44ed0a3..233dcfd 100644 --- a/client_test.go +++ b/client_test.go @@ -420,10 +420,13 @@ func TestUtils(t *testing.T) { res = ToString(true) assert.Equal(t, res, "true") - var arr = []interface{}{1,2,3,"boom"} + res = ToString(int64(10)) + assert.Equal(t, res, "10") + + var arr = []interface{}{1, 2, 3, int64(4), "boom"} res = ToString(arr) - assert.Equal(t, res, "[1,2,3,\"boom\"]") - + assert.Equal(t, res, "[1,2,3,4,\"boom\"]") + jsonMap := make(map[string]interface{}) jsonMap["object"] = map[string]interface{} {"foo": 1} res = ToString(jsonMap) diff --git a/utils.go b/utils.go index 3cc2aad..bd66d2e 100644 --- a/utils.go +++ b/utils.go @@ -48,6 +48,8 @@ func ToString(i interface{}) string { return strconv.Quote(s) case int: return strconv.Itoa(i.(int)) + case int64: + return strconv.FormatInt(i.(int64), 10) case float64: return strconv.FormatFloat(i.(float64), 'f', -1, 64) case bool: