Skip to content

Commit

Permalink
Add additional comments on JSON changes and remove unneeded schema ty…
Browse files Browse the repository at this point in the history
…pe comparison

Co-authored-by: Shiv Nagarajan <shiv@shopify.com>
  • Loading branch information
insom and shivnagarajan committed Feb 3, 2022
1 parent 0776376 commit 85120de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dml_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ func appendEscapedValue(buffer []byte, value interface{}, column schema.TableCol

switch v := value.(type) {
case string:
// 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
if column.Type == schema.TYPE_JSON {
return appendEscapedBuffer(buffer, []byte(v), true)
}
Expand All @@ -435,7 +436,8 @@ func appendEscapedValue(buffer []byte, value interface{}, column schema.TableCol

return appendEscapedString(buffer, v, rightPadLengthForBinaryColumn)
case []byte:
return appendEscapedBuffer(buffer, v, column.Type == schema.TYPE_JSON)
// schema type cannot be JSON at this point because all JSON results are strings
return appendEscapedBuffer(buffer, v, false)
case bool:
if v {
return append(buffer, '1')
Expand Down

0 comments on commit 85120de

Please sign in to comment.