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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM