MCPcopy
hub / github.com/keploy/keploy / mysqlIsSessionReusableCommand

Function mysqlIsSessionReusableCommand

pkg/models/lifetime.go:364–373  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

362// The check uses the packet Header.Type string so the models package
363// doesn't need to import the mysql wire package.
364func 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

Callers 1

DeriveLifetimeMethod · 0.85

Calls 1

Tested by

no test coverage detected