MCPcopy Create free account
hub / github.com/apecloud/myduckserver / encodeJsonDoc

Function encodeJsonDoc

binlogreplication/binlog_json_serialization.go:57–68  ·  view source on GitHub ↗

encodeJsonDoc encodes the specified |jsonDoc| into MySQL's custom/internal binary encoding so that it can be included in a binlog event. The internal MySQL JSON binary format is documented here: https://dev.mysql.com/doc/dev/mysql-server/latest/json__binary_8h.html And a third-party description is

(jsonDoc sql.JSONWrapper)

Source from the content-addressed store, hash-verified

55//
56// And a third-party description is here:
57// https://lafengnan.gitbooks.io/blog/content/mysql/chapter2.html
58func encodeJsonDoc(ctx context.Context, jsonDoc sql.JSONWrapper) (buffer []byte, err error) {
59 val, err := jsonDoc.ToInterface(ctx)
60 if err != nil {
61 return nil, err
62 }
63 typeId, encodedValue, err := encodeJsonValue(val)
64 if err != nil {
65 return nil, err
66 }
67 buffer = append(buffer, typeId)
68 return append(buffer, encodedValue...), nil
69}
70
71// encodeJsonArray encodes the specified |jsonArray| into MySQL's internal JSON encoding and returns

Calls 1

encodeJsonValueFunction · 0.85