Skip to content

Commit

Permalink
use sql.NullString when Scan NullString
Browse files Browse the repository at this point in the history
  • Loading branch information
acoshift committed Jul 5, 2018
1 parent b7d707d commit b6f6483
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions string.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ type nullString struct {
}

func (s *nullString) Scan(src interface{}) error {
*s.value, _ = src.(string)
return nil
var t sql.NullString
err := t.Scan(src)
*s.value = t.String
return err
}

func (s nullString) Value() (driver.Value, error) {
Expand Down

0 comments on commit b6f6483

Please sign in to comment.