LoginSignup
1
0

More than 1 year has passed since last update.

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

Posted at

はじめに

この記事は2022年月7にまとめていた「細かいつまずいたことをメモしておく(7月編)をそれぞれ投稿した内容になります
解決方法が最新でない可能性もありますのでご了承ください

問題

GoでMySQLを利用してレコード取得をしようとすると以下のエラーが発生しました

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

解決方法

DBの接続の語尾に?parseTime=trueをつけたら成功しました

main.go
var connect = fmt.Sprintf("%s:%s@%s/%s?parseTime=true", "root", "password", "tcp(db:3306)", "myapp")

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0