Skip to content

Commit

Permalink
[debezium] Format time.Time to string in TimestampConverter (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie authored Mar 18, 2024
1 parent 760362b commit 4ae2868
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/debezium/converters/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (TimestampConverter) Convert(value any) (any, error) {
return nil, nil
}

return timeValue, nil
return timeValue.Format(time.RFC3339Nano), nil
}

type YearConverter struct{}
Expand Down
2 changes: 1 addition & 1 deletion lib/debezium/converters/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestTimestampConverter_Convert(t *testing.T) {
// time.Time
value, err := converter.Convert(time.Date(2001, 2, 3, 4, 5, 0, 0, time.UTC))
assert.NoError(t, err)
assert.Equal(t, time.Date(2001, 2, 3, 4, 5, 0, 0, time.UTC), value)
assert.Equal(t, "2001-02-03T04:05:00Z", value)
}
}

Expand Down

0 comments on commit 4ae2868

Please sign in to comment.