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

return sql.NullTime if it available #1145

Merged

Conversation

shogo82148
Copy link
Contributor

Description

related to #960 (comment)

Will rows.ColumnTypes() (first value from db.Query()) return sql.NullTime instead of mysql.NullTime too?

My answer is yes.
rows.ColumnTypes() should return sql.NullTime.

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself / the copyright holder to the AUTHORS file

@shogo82148
Copy link
Contributor Author

Can we drop this line?

dsn + "&parseTime=false",

I think it is misuse of mysql.NullTime or sql.NullTime.
They should be treated like time.Time, and used with the parseTime=true option.

previous discussion is here #1049 (comment)

methane
methane previously approved these changes Aug 13, 2020
@shogo82148
Copy link
Contributor Author

Thanks for reviewing, but now tests fail.
I will fix it.

@shogo82148 shogo82148 marked this pull request as ready for review August 13, 2020 10:00
@julienschmidt julienschmidt added this to the v1.6.0 milestone Aug 14, 2020
@shogo82148 shogo82148 merged commit 84241ad into go-sql-driver:master Aug 16, 2020
@shogo82148 shogo82148 deleted the scan-type-return-sql-null-time branch August 16, 2020 02:33
tz70s pushed a commit to tz70s/mysql that referenced this pull request Sep 5, 2020
* return sql.NullTime if it available

* NullTime should be used with parseTime=true option
tz70s pushed a commit to tz70s/mysql that referenced this pull request Sep 5, 2020
* return sql.NullTime if it available

* NullTime should be used with parseTime=true option
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

3 participants