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

Combine both TimeInterval types into single type #75

Merged
merged 1 commit into from
May 22, 2019

Conversation

RobAtticus
Copy link
Member

Query generation and Cassandra's query running both used a type
called TimeInterval that did roughly the same thing. This change
combines the two into one type that can be used from the utils
package in internal/. This improves code reuse and keeps the two
representations in sync, and also increases the testability of
the code.

@codecov-io
Copy link

codecov-io commented May 20, 2019

Codecov Report

Merging #75 into master will increase coverage by 0.47%.
The diff coverage is 60.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #75      +/-   ##
==========================================
+ Coverage   57.13%   57.61%   +0.47%     
==========================================
  Files          76       77       +1     
  Lines        3719     3770      +51     
==========================================
+ Hits         2125     2172      +47     
- Misses       1570     1573       +3     
- Partials       24       25       +1
Impacted Files Coverage Δ
...d/tsbs_generate_queries/databases/influx/devops.go 32% <0%> (ø) ⬆️
...bs_generate_queries/databases/clickhouse/devops.go 9.94% <0%> (ø) ⬆️
...d/tsbs_generate_queries/databases/siridb/devops.go 26.92% <0%> (ø) ⬆️
cmd/tsbs_generate_queries/uses/devops/common.go 96.77% <100%> (-0.06%) ⬇️
...s_generate_queries/databases/timescaledb/devops.go 98.63% <100%> (+0.01%) ⬆️
...sbs_generate_queries/databases/cassandra/devops.go 24.09% <27.27%> (-0.6%) ⬇️
internal/utils/time_interval.go 95.83% <95.83%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3cfaae0...3ce1a1f. Read the comment docs.

)

const (
// ErrEndBeforeStart is an the error message for when a TimeInterval's end time
Copy link
Contributor

Choose a reason for hiding this comment

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

Superfluous the?

Also, I'm from the camp which avoids over-commenting, which in this case, IMO, this would be. Sometimes unnecessary comments can be just as bad as missing comments. I do understand its a personal thing mostly.

Scratch that, its exported. I'm blind.

@RobAtticus RobAtticus force-pushed the rrk/merge-time-intervals branch from 5a246ba to c29f7c7 Compare May 21, 2019 17:52
@RobAtticus RobAtticus requested a review from antekresic May 21, 2019 17:52
Copy link
Contributor

@antekresic antekresic left a comment

Choose a reason for hiding this comment

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

Changes look good!

Query generation and Cassandra's query running both used a type
called TimeInterval that did roughly the same thing. This change
combines the two into one type that can be used from the utils
package in internal/. This improves code reuse and keeps the two
representations in sync, and also increases the testability of
the code.
@RobAtticus RobAtticus force-pushed the rrk/merge-time-intervals branch from c29f7c7 to 3ce1a1f Compare May 21, 2019 18:18
@RobAtticus RobAtticus requested a review from antekresic May 21, 2019 18:18
@RobAtticus
Copy link
Member Author

Hey @antekresic , asking for a re-review because I added MustRandWindow for cleaner caller code. So this handles the panic issue by doing it in the library (we can eventually remove this in favor of bubbling up the errors).

I also rewrote the tests to use the t.Run trick I learned in your other PR :)

Copy link
Contributor

@antekresic antekresic left a comment

Choose a reason for hiding this comment

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

Nice changes, looking good!

@RobAtticus RobAtticus merged commit 3cad7a8 into timescale:master May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants