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

opt time value display the debug sql #92

Merged
merged 1 commit into from Oct 17, 2022
Merged

Conversation

lvxiaorun
Copy link
Contributor

hello:

when the gorm debug sql,the time type display require a optimize.
when open a mysql connection with param "loc=Local".
And then execute sql,if set the time.Time utc,like this

t := time.Now() t = t.UTC() err = db.Table("test").Where("created_at>?", t).Find(&result).Error

the debug will show this
SELECT * FROMtestWHERE created_at>'2022-10-12 15:02:46.587'

but check the mysql general log,it exec this sql

SELECT * FROMtestWHERE created_at>'2022-10-12 23:02:46.5873415'
so if set the param “loc=Local”,when debug a sql,time zones also need to be considered,
Otherwise the print and the actual execution will be inconsistent and misleading.

@jinzhu jinzhu merged commit bf5c03d into go-gorm:master Oct 17, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants