forked from mirror/enumer
bug fix if string instead of []byte is returned from db (this is the
case for postgreSQL)
This commit is contained in:
parent
af92007434
commit
af72d0db85
11
sql.go
11
sql.go
|
@ -12,12 +12,15 @@ const scanMethod = `func (i *%[1]s) Scan(value interface{}) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
bytes, ok := value.([]byte)
|
||||
str, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("value is not a byte slice")
|
||||
}
|
||||
bytes, ok := value.([]byte)
|
||||
if !ok {
|
||||
return fmt.Errorf("value is not a byte slice")
|
||||
}
|
||||
|
||||
str := string(bytes[:])
|
||||
str = string(bytes[:])
|
||||
}
|
||||
|
||||
val, err := %[1]sString(str)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue