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

Function TestExtractColumns_Update

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

Source from the content-addressed store, hash-verified

400}
401
402func TestExtractColumns_Update(t *testing.T) {
403 sql := "UPDATE users SET active = false, updated_at = NOW() WHERE id = 1"
404 astNode, err := Parse(sql)
405 if err != nil {
406 t.Fatalf("Failed to parse SQL: %v", err)
407 }
408
409 columns := ExtractColumns(astNode)
410 expected := []string{"active", "updated_at", "id"}
411 if !stringSlicesEqual(columns, expected) {
412 t.Errorf("Expected columns %v, got %v", expected, columns)
413 }
414}
415
416func TestExtractColumns_Insert(t *testing.T) {
417 sql := "INSERT INTO users (name, email) VALUES ('John', 'john@example.com')"

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