(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestExtractColumns(t *testing.T) { |
| 119 | tree, err := gosqlx.Parse("SELECT name, email FROM users WHERE active = true") |
| 120 | if err != nil { |
| 121 | t.Fatalf("parse failed: %v", err) |
| 122 | } |
| 123 | |
| 124 | columns := gosqlx.ExtractColumns(tree) |
| 125 | if len(columns) == 0 { |
| 126 | t.Fatal("expected at least one column, got none") |
| 127 | } |
| 128 | |
| 129 | colSet := make(map[string]bool) |
| 130 | for _, col := range columns { |
| 131 | colSet[col] = true |
| 132 | } |
| 133 | if !colSet["name"] { |
| 134 | t.Errorf("expected 'name' in columns, got: %v", columns) |
| 135 | } |
| 136 | if !colSet["email"] { |
| 137 | t.Errorf("expected 'email' in columns, got: %v", columns) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func TestExtractFunctions(t *testing.T) { |
| 142 | tree, err := gosqlx.Parse("SELECT COUNT(*), SUM(amount) FROM orders") |
nothing calls this directly
no test coverage detected