Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Oct 23, 2024
1 parent 38408f7 commit 902afad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
8 changes: 4 additions & 4 deletions clients/shared/default_value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.ParseDateTime(birthday.Format(ext.ISO8601), ext.TimestampTZKindType)
birthdayDateTime, err := ext.ParseDateTime(birthday.Format(ext.ISO8601), ext.TimestampTZKindType)
assert.NoError(t, err)

// date
Expand Down Expand Up @@ -85,17 +85,17 @@ func TestColumn_DefaultValue(t *testing.T) {
},
{
name: "date",
col: columns.NewColumnWithDefaultValue("", dateKind, birthdayExtDateTime),
col: columns.NewColumnWithDefaultValue("", dateKind, birthdayDateTime),
expectedValue: "'2022-09-06'",
},
{
name: "time",
col: columns.NewColumnWithDefaultValue("", timeKind, birthdayExtDateTime),
col: columns.NewColumnWithDefaultValue("", timeKind, birthdayDateTime),
expectedValue: "'03:19:24.942'",
},
{
name: "datetime",
col: columns.NewColumnWithDefaultValue("", dateTimeKind, birthdayExtDateTime),
col: columns.NewColumnWithDefaultValue("", dateTimeKind, birthdayDateTime),
expectedValue: "'2022-09-06T03:19:24.942Z'",
},
}
Expand Down
9 changes: 3 additions & 6 deletions lib/typing/ext/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
func TestParseFromInterface(t *testing.T) {
{
// Extended time
var vals []any
var vals []*ExtendedTime
vals = append(vals, NewExtendedTime(time.Now().UTC(), DateKindType, PostgresDateFormat))
vals = append(vals, NewExtendedTime(time.Now().UTC(), TimestampTZKindType, ISO8601))
vals = append(vals, NewExtendedTime(time.Now().UTC(), TimeKindType, PostgresTimeFormat))

for _, val := range vals {
extTime, err := ParseFromInterface(val, TimestampTZKindType)
_time, err := ParseFromInterface(val, TimestampTZKindType)
assert.NoError(t, err)
assert.Equal(t, val.(*ExtendedTime).GetTime(), extTime)
assert.Equal(t, val.GetTime(), _time)
}
}
{
Expand Down Expand Up @@ -70,7 +70,6 @@ func TestParseFromInterfaceTime(t *testing.T) {
for _, supportedTimeFormat := range SupportedTimeFormats {
_time, err := ParseFromInterface(now.Format(supportedTimeFormat), TimeKindType)
assert.NoError(t, err)
// Without passing an override format, this should return the same preserved dt format.
assert.Equal(t, _time.Format(supportedTimeFormat), now.Format(supportedTimeFormat))
}
}
Expand All @@ -80,8 +79,6 @@ func TestParseFromInterfaceDate(t *testing.T) {
for _, supportedDateFormat := range supportedDateFormats {
_time, err := ParseFromInterface(now.Format(supportedDateFormat), DateKindType)
assert.NoError(t, err)

// Without passing an override format, this should return the same preserved dt format.
assert.Equal(t, _time.Format(supportedDateFormat), now.Format(supportedDateFormat))
}
}
Expand Down

0 comments on commit 902afad

Please sign in to comment.