Skip to content

Commit 85120de

Browse files
insomshivnagarajan
andcommitted
Add additional comments on JSON changes and remove unneeded schema type comparison
Co-authored-by: Shiv Nagarajan <[email protected]>
1 parent 0776376 commit 85120de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dml_events.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ func appendEscapedValue(buffer []byte, value interface{}, column schema.TableCol
423423

424424
switch v := value.(type) {
425425
case string:
426+
// since https://github.com/go-mysql-org/go-mysql/pull/658/files merged, go-mysql returns JSON events as a string, but we would prefer them as []byte for consistency with other types
426427
if column.Type == schema.TYPE_JSON {
427428
return appendEscapedBuffer(buffer, []byte(v), true)
428429
}
@@ -435,7 +436,8 @@ func appendEscapedValue(buffer []byte, value interface{}, column schema.TableCol
435436

436437
return appendEscapedString(buffer, v, rightPadLengthForBinaryColumn)
437438
case []byte:
438-
return appendEscapedBuffer(buffer, v, column.Type == schema.TYPE_JSON)
439+
// schema type cannot be JSON at this point because all JSON results are strings
440+
return appendEscapedBuffer(buffer, v, false)
439441
case bool:
440442
if v {
441443
return append(buffer, '1')

0 commit comments

Comments
 (0)