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
5
sql.go
5
sql.go
|
@ -12,12 +12,15 @@ const scanMethod = `func (i *%[1]s) Scan(value interface{}) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
str, ok := value.(string)
|
||||
if !ok {
|
||||
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