Skip to content

Commit

Permalink
Merge bde91c0 into a4341c0
Browse files Browse the repository at this point in the history
  • Loading branch information
DoubleDi committed Jun 4, 2021
2 parents a4341c0 + bde91c0 commit 3a2717d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dataparser.go
Expand Up @@ -184,7 +184,10 @@ func (p *nullableParser) Parse(s io.RuneScanner) (driver.Value, error) {
for {
r, _, err := s.ReadRune()
if err != nil {
return nil, nil
if err != io.EOF {
return nil, fmt.Errorf("unexpected error on ReadRune: %v", err)
}
break
}

runes += string(r)
Expand Down
18 changes: 18 additions & 0 deletions dataparser_test.go
Expand Up @@ -476,6 +476,24 @@ func TestParseDataNewNullableArray(t *testing.T) {
inputdata: `\N`,
output: nil,
},
{
name: "nullable null date",
inputtype: "Nullable(Date)",
inputdata: `\N`,
output: nil,
},
{
name: "nullable not null datetime",
inputtype: "Nullable(DateTime)",
inputdata: "2018-01-02 12:34:56",
output: time.Date(2018, 1, 2, 12, 34, 56, 0, time.UTC),
},
{
name: "nullable not null date",
inputtype: "Nullable(Date)",
inputdata: "2018-01-02",
output: time.Date(2018, 1, 2, 0, 0, 0, 0, time.UTC),
},
{
name: "nullable null enum",
inputtype: "Nullable(Enum8('hello' = 1, 'world' = 2))",
Expand Down

0 comments on commit 3a2717d

Please sign in to comment.