MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestExtractColumns_WithOrderBy

Function TestExtractColumns_WithOrderBy

pkg/gosqlx/extract_test.go:376–387  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

374}
375
376func TestExtractColumns_WithOrderBy(t *testing.T) {
377 sql := "SELECT name, salary FROM employees ORDER BY salary"
378 astNode, err := Parse(sql)
379 if err != nil {
380 t.Fatalf("Failed to parse SQL: %v", err)
381 }
382
383 columns := ExtractColumns(astNode)
384 if !contains(columns, "name") || !contains(columns, "salary") {
385 t.Errorf("Expected name and salary columns, got: %v", columns)
386 }
387}
388
389func TestExtractColumns_WithHaving(t *testing.T) {
390 sql := "SELECT department, COUNT(*) as cnt FROM employees GROUP BY department HAVING cnt > 5"

Callers

nothing calls this directly

Calls 5

ParseFunction · 0.85
ExtractColumnsFunction · 0.85
containsFunction · 0.70
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected