Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
xycphp opened this issue Dec 7, 2018 · 1 comment

Comments

@xycphp
Copy link

xycphp commented Dec 7, 2018

type Short struct {
K string orm:"k"
V int64 orm:"v"
ExpireTime int orm:"expire_time"
Click int orm:"click"
CreateTime time.Time orm:"create_time"
}
数据库字段为datetime,session.Table(&s).Select() 报错误

@fizzday
Copy link
Member

fizzday commented Dec 12, 2018

@xycphp 这个有两种解决方案.
一. time.Time 改为string类型
二. 保持time.Time类型不变, dsn中加入parseTime=true的参数

再database/sql的官方文档中有关于 datetime 类型处理的说明

@fizzday fizzday closed this as completed Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants