本文主要是介绍gin 报错unsupported Scan, storing driver.Value type []uint8 into type *time.Time,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
背景:
报错:
[2019-06-20 17:46:55] sql: Scan error on column index 5, name "last_time": unsupported Scan, storing driver.Value type []uint8 into type *time.Time
源码:
模型
type Bigdata_Task_Project struct {ID int64 `gorm:"primary_key";json:"id"`//Name string`gorm:"type:varchar(64)";json:"name"`//负责人名字Title string `gorm:"type:varchar(64)"json:"title"`//任务标题Runtime string `gorm:"type:varchar(255)";json:"runtime"`//一次性任务或者定时任务LastTime time.Time `json:"last_time"`//上一次执行时间Dingmachine string `gorm:"default:https://oapi.dingtalk.com/robot/send?access_token=d3fa3d0d867838f9c99f5c5710b42eb988f6b9e9e7039144a7b235b855074a66";json:"dingmachine"`//钉钉机器人Filename string`json:"filename"`//文件名字Ossaddress string`json:"ossaddress"`//oss地址UpdateTime time.Time`json:"update_time"` //更新时间CreateTime time.Time `gorm:"type:datetime";json:"create_time"`//创建时间IsDelete int `gorm:"default:0";json:"is_delete"`//是否删除Used int`json:"used";gorm:"default:0"` //是否激活Type int `json:"type"`
}
数据库字段
solution:
数据库连接时设置
charset=utf8&parseTime=true`
这篇关于gin 报错unsupported Scan, storing driver.Value type []uint8 into type *time.Time的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!