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

前端 未结 3 1401
借酒劲吻你
借酒劲吻你 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:31

    In my case, I had a similar problem but for my particular usecase, it was a struct with a select which didn't work, since I only needed to select data, then I proceeded to simply:

    change the data type from time.Time to string

    This solved my problem, and I was able to get the data from the database. So perhaps it is not the best solution, but this is what worked for me.

    Mr Karlom's solution also worked for me, this is just an alternative method.

提交回复
热议问题