[go: nahoru, domu]

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

feat(spanner): add Interval/Timestamp/time-zone operations #14120

Merged
merged 1 commit into from
May 3, 2024

Conversation

devbww
Copy link
Contributor
@devbww devbww commented May 2, 2024
StatusOr<Timestamp> Add(Timestamp const&, Interval const&,
                        absl::string_view time_zone);
StatusOr<Interval> Diff(Timestamp const&, Timestamp const&,
                        absl::string_view time_zone);

A timestamp and a time zone represent a civil time, to which an Interval can be added. Similarly, the difference between two such civil times is an Interval (albeit without a years/months component).


This change is Reviewable

```
StatusOr<Timestamp> Add(Timestamp const&, Interval const&,
                        absl::string_view time_zone);
StatusOr<Interval> Diff(Timestamp const&, Timestamp const&,
                        absl::string_view time_zone);
```
A timestamp and a time zone represent a civil time, to which an Interval
can be added. Similarly, the difference between two such civil times is
an Interval (albeit without a years/months component).
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label May 2, 2024
Copy link
codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.23%. Comparing base (7e7070e) to head (d580284).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14120   +/-   ##
=======================================
  Coverage   93.23%   93.23%           
=======================================
  Files        2203     2203           
  Lines      188807   188872   +65     
=======================================
+ Hits       176031   176103   +72     
+ Misses      12776    12769    -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@devbww devbww marked this pull request as ready for review May 2, 2024 22:50
@devbww devbww requested a review from a team as a code owner May 2, 2024 22:50
@@ -247,6 +253,63 @@ TEST(Interval, OutputStreaming) {
EXPECT_EQ("1 year 2 months 3 days 04:05:06.123456789", os.str());
}

TEST(Interval, TimestampOperations) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: might want to separate this into multiple tests, so it is clear what each is testing, but fine to leave as is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I think it is clear enough as to what is being tested. And indeed, it may well be clearer testing these "inverse" operations right next to each other.

@devbww devbww merged commit 2eb6963 into googleapis:main May 3, 2024
63 checks passed
@devbww devbww deleted the interval-extra-operations branch May 3, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants