【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