forked from mirror/enumer
fixed generated Scan method
This commit is contained in:
parent
af7ef17caa
commit
42a5bdff6f
6
sql.go
6
sql.go
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue