-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 microseconds resolution for created_at/updated_at/deleted_at #2512
Conversation
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #2512 +/- ##
==========================================
- Coverage 78.62% 78.61% -0.02%
==========================================
Files 630 629 -1
Lines 51318 51158 -160
==========================================
- Hits 40349 40217 -132
+ Misses 8984 8963 -21
+ Partials 1985 1978 -7
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 15 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
…patible with MS SQLServer
…o date handling and fix AssertNE(err, nil) to AssertNil(err)
…/Gtime and also append timezone info. Make sure using datetime2 or datetimeoffset for MSSQL datetime columns.
MySQL 5.7 does not recoginze +07:00 in timestamp string, while MySQL 8.0/PostgreSQL/MSSQL/Sqlite/Dameng do.
So we have to use gtime.Now().Local().Time.Format("2006-01-02 15:04:05.999999") instead of gtime.Now().Time.Format("2006-01-02 15:04:05.999999-09:00") when setting updated_at/deleted_at as string. This implemantion also requires the DB server(or docker container/host os) other than MySQL running at the same timezone as the client, otherwise the timestamp might be updated with wrong timezone (mostly UTC). |
MySQL 5.7 does not recognize +07:00 in timestamp string, while MySQL 8.0 can. |
Confirmed all DBMS drivers implemented in contrib/drivers can correctly parse string with format '2023-03-10 13:19:03.999999' into datetime/timestamp types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restore the default organization of imports
The unit test needs to add a test that is not six decimal places to verify that it can be written properly. |
…ts value to gtime.Now() instead of string
# Conflicts: # contrib/drivers/README.MD
现在应该比较完美了 |
It should be perfect now |
test added. |
@wesleywu Awesome! |
We often need microseconds resolution for timestamp/datetime columns, especially when we sort records by timestamp column and do some batch processing.
The current implementation in GF uses String() representation of gtime/time for insert/update operations, thus truncating the time precision to second.