MCPcopy Create free account
hub / github.com/bytebase/bytebase / mustAnalyze

Function mustAnalyze

backend/plugin/parser/pg/query_span_loader_poc_test.go:531–546  ·  view source on GitHub ↗

---------- helpers ----------

(t *testing.T, cat *catalog.Catalog, sql string)

Source from the content-addressed store, hash-verified

529// ---------- helpers ----------
530
531func mustAnalyze(t *testing.T, cat *catalog.Catalog, sql string) *catalog.Query {
532 t.Helper()
533 stmts, err := ParsePg(sql)
534 if err != nil {
535 t.Fatalf("parse %q: %v", sql, err)
536 }
537 selStmt, ok := stmts[0].AST.(*ast.SelectStmt)
538 if !ok {
539 t.Fatalf("expected SelectStmt, got %T", stmts[0].AST)
540 }
541 q, err := cat.AnalyzeSelectStmt(selStmt)
542 if err != nil {
543 t.Fatalf("AnalyzeSelectStmt(%q): %v", sql, err)
544 }
545 return q
546}
547
548func mustParseSelect(t *testing.T, sql string) *ast.SelectStmt {
549 t.Helper()

Calls 2

ParsePgFunction · 0.85
FatalfMethod · 0.80

Tested by

no test coverage detected