MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / tryMySQLConnection

Function tryMySQLConnection

internal/sqltest/native/mysql.go:192–203  ·  view source on GitHub ↗
(ctx context.Context, uri string)

Source from the content-addressed store, hash-verified

190}
191
192func 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}

Callers 1

waitForMySQLFunction · 0.85

Calls 2

OpenMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected