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

Function TestExtractColumns_SimpleSelect

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

Source from the content-addressed store, hash-verified

306}
307
308func TestExtractColumns_SimpleSelect(t *testing.T) {
309 sql := "SELECT id, name, email FROM users"
310 astNode, err := Parse(sql)
311 if err != nil {
312 t.Fatalf("Failed to parse SQL: %v", err)
313 }
314
315 columns := ExtractColumns(astNode)
316 expected := []string{"id", "name", "email"}
317 if !stringSlicesEqual(columns, expected) {
318 t.Errorf("Expected columns %v, got %v", expected, columns)
319 }
320}
321
322func TestExtractColumns_WithAsterisk(t *testing.T) {
323 sql := "SELECT * FROM users"

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected