From 4ae2868aa4cd5af564eb4b37b5ac8b41de1b4f1d Mon Sep 17 00:00:00 2001 From: Nathan <148575555+nathan-artie@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:21:49 -0700 Subject: [PATCH] [debezium] Format `time.Time` to string in `TimestampConverter` (#301) --- lib/debezium/converters/time.go | 2 +- lib/debezium/converters/time_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/debezium/converters/time.go b/lib/debezium/converters/time.go index 73b903ae..62cd761e 100644 --- a/lib/debezium/converters/time.go +++ b/lib/debezium/converters/time.go @@ -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{} diff --git a/lib/debezium/converters/time_test.go b/lib/debezium/converters/time_test.go index 8ff6a54f..a5a142eb 100644 --- a/lib/debezium/converters/time_test.go +++ b/lib/debezium/converters/time_test.go @@ -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) } }