【go学习】查询数据库报错 "created_at": unsupported Scan, storing driver.Value type []uint8 into type *time.Time

错误信息

sql: Scan error on column index 1, name "created_at": unsupported Scan, storing driver.Value type []uint8 into type *time.Time

解决方案

在连接数据库的末尾加上parseTime=true,如下:

Db, err = gorm.Open("mysql", "username:password@tcp(127.0.0.1:3306)/gin?charset=utf8&parseTime=true")