mgutz / dat

Go Postgres Data Access Toolkit
Other
612 stars 62 forks source link

Fix panic on NullTime.UnmarshalJSON #73

Open KhodeN opened 7 years ago

KhodeN commented 7 years ago
type WithDate struct {
    Time dat.NullTime `json:"time"`
}

func TestParseNumberAsDate(t *testing.T) {
    data := `{"time":5}`
    result := &WithDate{}
    json.Unmarshal([]byte(data), result) // PANIC!
}
JelteF commented 7 years ago

This test should probably be added to the actual tests as well.

KhodeN commented 7 years ago

Please, accept