mysqlIsSessionReusableCommand returns true when a MySQL mock represents a single connection-alive command whose response is input-independent. These are safe to route into the session pool regardless of the recorder's on-disk tag because the recorded response matches any client's same-command invoca
(m *Mock)
| 362 | // The check uses the packet Header.Type string so the models package |
| 363 | // doesn't need to import the mysql wire package. |
| 364 | func mysqlIsSessionReusableCommand(m *Mock) bool { |
| 365 | if m == nil || len(m.Spec.MySQLRequests) != 1 { |
| 366 | return false |
| 367 | } |
| 368 | hdr := m.Spec.MySQLRequests[0].PacketBundle.Header |
| 369 | if hdr == nil { |
| 370 | return false |
| 371 | } |
| 372 | return IsMySQLSessionReusableCommandType(hdr.Type) |
| 373 | } |
| 374 | |
| 375 | // IsMySQLSessionReusableCommandType reports whether a MySQL command |
| 376 | // packet type (the wire Header.Type string, e.g. "COM_PING") is a |
no test coverage detected