(ctx context.Context, uri string)
| 190 | } |
| 191 | |
| 192 | func tryMySQLConnection(ctx context.Context, uri string) error { |
| 193 | db, err := sql.Open("mysql", uri) |
| 194 | if err != nil { |
| 195 | slog.Debug("native/mysql", "open-attempt", err) |
| 196 | return err |
| 197 | } |
| 198 | defer db.Close() |
| 199 | // Use a short timeout for ping to avoid hanging |
| 200 | pingCtx, cancel := context.WithTimeout(ctx, 2*time.Second) |
| 201 | defer cancel() |
| 202 | return db.PingContext(pingCtx) |
| 203 | } |
no test coverage detected