Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppConfig ¶
type AppConfig struct {
MySQL MySQLConfig
SSH SSHConfig
AllowWriter bool
}
AppConfig holds the resolved settings for the application.
type CLI ¶
type CLI struct {
DSN string `help:"MySQL DSN (env: MYSQL_DSN)."`
Host string `name:"mysql-host" help:"MySQL host (env: MYSQL_HOST)."`
Port int `help:"MySQL port (env: MYSQL_PORT)."`
User string `name:"mysql-user" help:"MySQL user (env: MYSQL_USER)."`
Password string `help:"MySQL password (env: MYSQL_PASSWORD)."`
DB string `name:"mysql-db" help:"MySQL database (env: MYSQL_DB)."`
Socket string `help:"MySQL unix socket (env: MYSQL_SOCKET)."`
TLS string `help:"MySQL TLS config name (env: MYSQL_TLS)."`
SSHHost string `help:"SSH bastion host (env: SSH_HOST)."`
SSHPort int `help:"SSH bastion port (env: SSH_PORT)."`
SSHUser string `help:"SSH bastion user (env: SSH_USER)."`
SSHKey string `help:"SSH private key file path (env: SSH_KEY)."`
SSHKnownHosts string `help:"known_hosts path for strict checking (env: SSH_KNOWN_HOSTS)."`
SSHNoStrictHostKey bool `help:"Disable strict host key checking (env: SSH_NO_STRICT_HOST_KEY)."`
AllowWriter bool `help:"Allow connecting to writer/primary (default: reader only)."`
Version kong.VersionFlag `name:"version" help:"Print version information and quit."`
Kill *KillCmd `cmd:"" help:"Kill a query or connection by process ID."`
List *ListCmd `cmd:"" help:"List running queries (from processlist)."`
}
CLI defines the top-level command structure for mysql-kill.
type Execer ¶
type Execer interface {
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}
Execer executes SQL statements.
type KillCmd ¶
type KillCmd struct {
QueryID int64 `arg:"" name:"id" help:"MySQL process (query) ID to target."`
Kill bool `help:"Kill the connection (pt-kill-inspired --kill)."`
KillQuery bool `help:"Kill only the running query (pt-kill-inspired --kill-query)."`
DryRun bool `help:"Print the SQL/CALL without executing."`
}
KillCmd represents the kill subcommand.
type ListCmd ¶
type ListCmd struct {
Match string `help:"Filter by SQL regex (INFO)."`
}
ListCmd represents the list subcommand.
type MySQLConfig ¶
type MySQLConfig struct {
DSN string
Host string
Port int
User string
Password string
DB string
Socket string
TLS string
}
MySQLConfig holds MySQL connection settings.
Click to show internal directories.
Click to hide internal directories.