Skip to content

Commit

Permalink
Fixing binlog jsonSerializer from change to use new LazyJSONDocument …
Browse files Browse the repository at this point in the history
…type.
  • Loading branch information
fulghum committed May 1, 2024
1 parent 3e885e4 commit 7e651ef
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,17 @@ func (j jsonSerializer) serialize(ctx *sql.Context, typ sql.Type, descriptor val
return nil, err
}
if json != nil {
jsonDoc, ok := json.(gmstypes.JSONDocument)
if !ok {
return nil, fmt.Errorf("supported JSON type: %T", json)
var jsonDoc gmstypes.JSONDocument
if lazyJsonDoc, ok := json.(*gmstypes.LazyJSONDocument); ok {
i, err := lazyJsonDoc.ToInterface()
if err != nil {
return nil, err
}
jsonDoc = gmstypes.JSONDocument{Val: i}
} else if _, ok := json.(gmstypes.JSONDocument); ok {
jsonDoc = json.(gmstypes.JSONDocument)
} else {
return nil, fmt.Errorf("unsupported JSON type: %T", json)
}

jsonBuffer, err := encodeJsonDoc(jsonDoc)
Expand Down

0 comments on commit 7e651ef

Please sign in to comment.