golang sqlx 对 mysql 进行查询的时候, 出现错误:

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

解救有方案:在创建连接的地址后面添加 ?parseTime=true

db, err := sqlx.Connect("mysql", "myuser:mypass@tcp(127.0.0.1:3306)/mydb?parseTime=true")

参考:unsupported Scan, storing driver.Value type []uint8 into type *time.Time

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐