go-testdb icon indicating copy to clipboard operation
go-testdb copied to clipboard

Support for returning sql.NullString

Open jabclab opened this issue 9 years ago • 0 comments

At present either a string or time.Time is returned for the driver.Value within RowsFromCSVString. It would be nice to add support returning a sql.NullString.

It could look something like:

type testDriver struct {
    // as is
    enableNullParsing bool
}

// Within RowsFromCSVString...
if d.enableTimeParsing {
    // as is
} else if d.enableNullParsing && v == "" {
    row[i] = sql.NullString{}
} else {
    row[i] = v
}

Happy to knock this up into a PR if it's something you'd like to see added.

jabclab avatar May 13 '15 15:05 jabclab