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

Support for DATETIME columns in DBRunner #129

Merged
merged 3 commits into from
Sep 1, 2022
Merged

Conversation

k2tzumi
Copy link
Collaborator

@k2tzumi k2tzumi commented Aug 31, 2022

fix #124

Reason for concern

  • Isn't the DATETIME format different for different types of databases?
    Can you identify the format from the DB connection driver?
    No generic DateTime formatting library exists?
  • What time zone should the date be in?
  • How to implement the verification code?
  • Support other formats besides DATETIME?
    The following types exist, but they are all treated as numbers
    DECIMAL, BOOL, INT, BIGINT

@github-actions

This comment has been minimized.

Copy link
Owner

@k1LoW k1LoW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

I understand your concern.
The handling of return values will need to be improved in the future.

@k2tzumi
Copy link
Collaborator Author

k2tzumi commented Sep 1, 2022

I tried running it locally and got an error.
It seems that the layout is not well specified.

invalid datetime column: evaluated created_at, but got DATETIME(2022-09-01 19:07:30): parsing time "2016-01-02 15:04:05" as "2022-09-01 19:07:30": cannot parse "-01-02 15:04:05" as "2"

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2022

Code Metrics Report

main (32037d6) #129 (1454eb7) +/-
Coverage 73.5% 73.4% -0.1%
Code to Test Ratio 1:0.7 1:0.7 -0.0
Test Execution Time 40s 45s +5s
Details
  |                     | main (32037d6) | #129 (1454eb7) |  +/-  |
  |---------------------|----------------|----------------|-------|
- | Coverage            |          73.5% |          73.4% | -0.1% |
  |   Files             |             18 |             18 |     0 |
  |   Lines             |           2000 |           2004 |    +4 |
  |   Covered           |           1470 |           1470 |     0 |
- | Code to Test Ratio  |          1:0.7 |          1:0.7 |  -0.0 |
  |   Code              |           3871 |           3879 |    +8 |
  |   Test              |           2792 |           2792 |     0 |
- | Test Execution Time |            40s |            45s |   +5s |

Code coverage of files in pull request scope (63.0% → 60.6%)

Files Coverage +/-
db.go 60.6% -2.4%

Reported by octocov

@@ -95,7 +95,7 @@ func (rnr *dbRunner) Run(ctx context.Context, q *dbQuery) error {
case "TEXT", "VARCHAR", "NVARCHAR":
row[c] = s
case "DATETIME":
dt, err := time.Parse(s, "2006-01-02 15:04:05")
dt, err := time.Parse("2006-01-02 15:04:05", s)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specified argument was incorrect. 🤮

@k2tzumi k2tzumi merged commit 6350d8a into main Sep 1, 2022
@k2tzumi k2tzumi deleted the support-db-datetime-type branch September 1, 2022 13:15
@k2tzumi k2tzumi mentioned this pull request Sep 1, 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.

Error when selecting date column in dBRunner
2 participants