Skip to content

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Dec 12, 2024
1 parent 5b111f0 commit 5c4e7f0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/debezium/converters/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

Expand Down

0 comments on commit 5c4e7f0

Please sign in to comment.