fixed generated Scan method

This commit is contained in:
marco 2016-01-12 13:05:56 +01:00
parent af7ef17caa
commit 42a5bdff6f
1 changed files with 4 additions and 2 deletions

6
sql.go
View File

@ -8,11 +8,13 @@ const valuer = `func (i %[1]s) Value() (driver.Value, error) {
`
const scanner = `func (i %[1]s) Scan(value interface{}) error {
str, ok := value.(string)
bytes, ok := value.([]byte)
if !ok {
fmt.Errorf("value is not a string")
fmt.Errorf("value is not a byte slice")
}
str := string(bytes[:])
val, err := %[1]sString(str)
if err != nil {
return err