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
support parse time config #119
Conversation
👍 |
I hope this can help you in your project, but we should notice that it is a customized Time which needs to output zero time correctly for MySQL. |
Another way is to return origin golang Time, but for zero time, we return string "0000-00-00 00:00:00" directly. which way do you think better? |
That is the approach I took in https://github.com/siddontang/go-mysql/pull/86/files#diff-d9f966f86227646d11c3024f8cb537a8R651 If the date is |
There does not handle fraction correctly. So your prefer return string for zero time? @shlomi-noach |
You are right. Is it possible to return For complete zero, I prefer a string, because it isn't actually a real |
Hold on. Which is why So yes, The zero-Time is a valid time: https://golang.org/pkg/time/#Time.IsZero, denoting "January 1, year 1, 00:00:00 UTC.". This does not equal |
If you create a table with a field Go Time can't handle both "0000-00-00 00:00:00" and "0000-00-00 00:00:00.123456", so we should return string for it, and for other valid time, we can return Time directly. |
This is also what I was saying :) |
I have changed the return type, for zero return string, the other return golang time. |
@siddontang if you like to wait I will update my |
I will wait your good news :-) |
Any update? Can it work well in your production? |
@siddontang I haven't deployed it yet. And it will be at least a week in testing; what i'd suggest is you can merge and I'll open an issue if there's any problems. |
ok, I have merged and you can use the master now. @shlomi-noach |
@shlomi-noach
I support a ParseTime config to decode timestamp and datetime to a Time structure.