check destination type whether it's *time.Time or not.
This commit is contained in:
parent
65fd601635
commit
f86c8f208d
|
@ -324,6 +324,9 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
|||
case C.SQLITE_TEXT:
|
||||
var err error
|
||||
s := C.GoString((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))))
|
||||
|
||||
switch dest[i].(type) {
|
||||
case *time.Time:
|
||||
if rc.decltype[i] == "timestamp" || rc.decltype[i] == "datetime" {
|
||||
dest[i], err = time.Parse(SQLiteTimestampFormat, s)
|
||||
if err != nil {
|
||||
|
@ -338,6 +341,10 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
|||
} else {
|
||||
dest[i] = s
|
||||
}
|
||||
default:
|
||||
dest[i] = s
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue