Skip to content

Commit

Permalink
BUGFIX: fix unmarshal of large integers (#101)
Browse files Browse the repository at this point in the history
fix #100
  • Loading branch information
taylorchu authored Aug 7, 2017
1 parent c4f8f99 commit 6125e71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (n *NullString) UnmarshalJSON(b []byte) error {

// UnmarshalJSON correctly deserializes a NullInt64 from JSON
func (n *NullInt64) UnmarshalJSON(b []byte) error {
var s interface{}
var s json.Number
if err := json.Unmarshal(b, &s); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
var (
filledRecord = nullTypedRecord{
StringVal: NewNullString("wow"),
Int64Val: NewNullInt64(42),
Int64Val: NewNullInt64(1483272000),
Float64Val: NewNullFloat64(1.618),
TimeVal: NewNullTime(time.Date(2009, 1, 3, 18, 15, 5, 0, time.UTC)),
BoolVal: NewNullBool(true),
Expand Down Expand Up @@ -70,7 +70,7 @@ func TestNullTypesJSON(t *testing.T) {
in: &filledRecord.Int64Val,
in2: filledRecord.Int64Val,
out: new(NullInt64),
want: "42",
want: "1483272000",
},
{
in: &filledRecord.StringVal,
Expand Down

0 comments on commit 6125e71

Please sign in to comment.