Skip to content

Commit 6a4e903

Browse files
authored
Add comment about golang type of RowsEvent.Rows (#828)
Signed-off-by: lance6716 <[email protected]>
1 parent 9e77fe8 commit 6a4e903

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

replication/row_event.go

+30
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,36 @@ func (e *TableMapEvent) JsonColumnCount() uint64 {
866866
// RowsEventStmtEndFlag is set in the end of the statement.
867867
const RowsEventStmtEndFlag = 0x01
868868

869+
// RowsEvent represents a MySQL rows event like DELETE_ROWS_EVENT,
870+
// UPDATE_ROWS_EVENT, etc.
871+
// RowsEvent.Rows saves the rows data, and the MySQL type to golang type mapping
872+
// is
873+
// - MYSQL_TYPE_NULL: nil
874+
// - MYSQL_TYPE_LONG: int32
875+
// - MYSQL_TYPE_TINY: int8
876+
// - MYSQL_TYPE_SHORT: int16
877+
// - MYSQL_TYPE_INT24: int32
878+
// - MYSQL_TYPE_LONGLONG: int64
879+
// - MYSQL_TYPE_NEWDECIMAL: string / "github.com/shopspring/decimal".Decimal
880+
// - MYSQL_TYPE_FLOAT: float32
881+
// - MYSQL_TYPE_DOUBLE: float64
882+
// - MYSQL_TYPE_BIT: int64
883+
// - MYSQL_TYPE_TIMESTAMP: string / time.Time
884+
// - MYSQL_TYPE_TIMESTAMP2: string / time.Time
885+
// - MYSQL_TYPE_DATETIME: string / time.Time
886+
// - MYSQL_TYPE_DATETIME2: string / time.Time
887+
// - MYSQL_TYPE_TIME: string
888+
// - MYSQL_TYPE_TIME2: string
889+
// - MYSQL_TYPE_DATE: string
890+
// - MYSQL_TYPE_YEAR: int
891+
// - MYSQL_TYPE_ENUM: int64
892+
// - MYSQL_TYPE_SET: int64
893+
// - MYSQL_TYPE_BLOB: []byte
894+
// - MYSQL_TYPE_VARCHAR: string
895+
// - MYSQL_TYPE_VAR_STRING: string
896+
// - MYSQL_TYPE_STRING: string
897+
// - MYSQL_TYPE_JSON: []byte / *replication.JsonDiff
898+
// - MYSQL_TYPE_GEOMETRY: []byte
869899
type RowsEvent struct {
870900
// 0, 1, 2
871901
Version int

0 commit comments

Comments
 (0)