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

Function TestExtractFunctions_WindowFunction

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

Source from the content-addressed store, hash-verified

530}
531
532func TestExtractFunctions_WindowFunction(t *testing.T) {
533 sql := "SELECT name, salary, ROW_NUMBER() OVER (ORDER BY salary DESC) as rank FROM employees"
534 astNode, err := Parse(sql)
535 if err != nil {
536 t.Fatalf("Failed to parse SQL: %v", err)
537 }
538
539 functions := ExtractFunctions(astNode)
540 if !contains(functions, "ROW_NUMBER") {
541 t.Errorf("Expected 'ROW_NUMBER' window function, got: %v", functions)
542 }
543}
544
545func TestExtractFunctions_Update(t *testing.T) {
546 sql := "UPDATE users SET updated_at = NOW(), name = UPPER(name) WHERE id = 1"

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected