【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")

posted @ 2022-02-13 13:48  gtea  阅读(2586)  评论(0编辑  收藏  举报