From 5c4e7f076c58751f019976db9abe52b7ed9644b8 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Wed, 11 Dec 2024 17:12:24 -0800 Subject: [PATCH] Clean up. --- lib/debezium/converters/basic.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/debezium/converters/basic.go b/lib/debezium/converters/basic.go index 990cc628..bb868b96 100644 --- a/lib/debezium/converters/basic.go +++ b/lib/debezium/converters/basic.go @@ -106,9 +106,8 @@ func (a Array) Convert(value any) (any, error) { return constants.ToastUnavailableValuePlaceholder, nil } - // Convert value which is an array of []interface{} to array of JSON objects. if a.json { - // Parse the individual elements + // Debezium will give us a list of JSON strings. We will then need to convert them to JSON objects. elements, ok := value.([]any) if !ok { return nil, fmt.Errorf("expected []interface{}, got %T", value) @@ -118,8 +117,7 @@ func (a Array) Convert(value any) (any, error) { for i, element := range elements { if castedElement, ok := element.(string); ok { var obj any - err := json.Unmarshal([]byte(castedElement), &obj) - if err != nil { + if err := json.Unmarshal([]byte(castedElement), &obj); err != nil { return nil, err }