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

前端 未结 3 1437
借酒劲吻你
借酒劲吻你 2021-01-31 08:16

I have difficulty querieing for users, which is defined as:

type User struct {
    ID           int       `db:\"id\" json:\"id\"`            
    UserName     st         


        
3条回答
  •  执念已碎
    2021-01-31 08:37

    Alright, I found the solution, thanks this answer. The problem goes by adding ?parseTime=true to the db mapper. Like this:

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

提交回复
热议问题