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

Use time.Time in more places #976

Merged
merged 4 commits into from
Oct 23, 2024
Merged

Use time.Time in more places #976

merged 4 commits into from
Oct 23, 2024

Conversation

Tang8330
Copy link
Contributor

@Tang8330 Tang8330 commented Oct 22, 2024

As the title states. The goal is to eventually get rid of ExtendedTime altogether.

@Tang8330 Tang8330 changed the title WIP. Use time.Time in more places Oct 22, 2024
@Tang8330 Tang8330 marked this pull request as ready for review October 22, 2024 20:25
@Tang8330 Tang8330 requested a review from a team as a code owner October 22, 2024 20:25
@Tang8330 Tang8330 marked this pull request as draft October 22, 2024 20:25
@Tang8330 Tang8330 marked this pull request as ready for review October 22, 2024 20:29
@@ -25,7 +25,7 @@ var dialects = []sql.Dialect{

func TestColumn_DefaultValue(t *testing.T) {
birthday := time.Date(2022, time.September, 6, 3, 19, 24, 942000000, time.UTC)
birthdayExtDateTime, err := ext.ParseExtendedDateTime(birthday.Format(ext.ISO8601), ext.TimestampTZKindType)
birthdayExtDateTime, err := ext.ParseDateTime(birthday.Format(ext.ISO8601), ext.TimestampTZKindType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: want to rename birthdayExtDateTime to birthdayDateTime?

@@ -18,7 +18,7 @@ func TestParseFromInterface(t *testing.T) {
for _, val := range vals {
extTime, err := ParseFromInterface(val, TimestampTZKindType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename this var too?

@@ -18,7 +18,7 @@ func TestParseFromInterface(t *testing.T) {
for _, val := range vals {
extTime, err := ParseFromInterface(val, TimestampTZKindType)
assert.NoError(t, err)
assert.Equal(t, val, extTime)
assert.Equal(t, val.(*ExtendedTime).GetTime(), extTime)
Copy link
Contributor

Choose a reason for hiding this comment

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

On line 13, can we declare vals as []ExtendedTime instead of []any so we don't have to cast val here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh or will that make ParseFromInterface not accept it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can accept ExtendedTime!

assert.NoError(t, err)
assert.Equal(t, TimeKindType, et.GetNestedKind().Type)
// Without passing an override format, this should return the same preserved dt format.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this comment no longer relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, we don't need it anymore!

assert.NoError(t, err)
assert.Equal(t, DateKindType, et.GetNestedKind().Type)

// Without passing an override format, this should return the same preserved dt format.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same with this one

Copy link
Contributor

@danafallon danafallon left a comment

Choose a reason for hiding this comment

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

A few nitpicks, otherwise lg!

@Tang8330 Tang8330 merged commit 370c304 into master Oct 23, 2024
3 checks passed
@Tang8330 Tang8330 deleted the more-improvement branch October 23, 2024 15:57
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.

2 participants