(description string)
| 22 | ) |
| 23 | |
| 24 | func ToEventDML(description string) EventDML { |
| 25 | // description can be a statement (`UPDATE my_table ...`) or a RBR event name (`UpdateRowsEventV2`) |
| 26 | description = strings.TrimSpace(strings.Split(description, " ")[0]) |
| 27 | switch strings.ToLower(description) { |
| 28 | case "insert": |
| 29 | return InsertDML |
| 30 | case "update": |
| 31 | return UpdateDML |
| 32 | case "delete": |
| 33 | return DeleteDML |
| 34 | } |
| 35 | if strings.HasPrefix(description, "WriteRows") { |
| 36 | return InsertDML |
| 37 | } |
| 38 | if strings.HasPrefix(description, "UpdateRows") { |
| 39 | return UpdateDML |
| 40 | } |
| 41 | if strings.HasPrefix(description, "DeleteRows") { |
| 42 | return DeleteDML |
| 43 | } |
| 44 | return NotDML |
| 45 | } |
| 46 | |
| 47 | // BinlogDMLEvent is a binary log rows (DML) event entry, with data |
| 48 | type BinlogDMLEvent struct { |
no outgoing calls
no test coverage detected
searching dependent graphs…