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

Function TestAddJoin

pkg/transform/joins_test.go:23–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestAddJoin(t *testing.T) {
24 stmt := mustParse(t, "SELECT * FROM users")
25 cond := &ast.BinaryExpression{
26 Left: &ast.Identifier{Name: "id", Table: "orders"},
27 Operator: "=",
28 Right: &ast.Identifier{Name: "user_id", Table: "users"},
29 }
30 err := Apply(stmt, AddJoin("LEFT", "orders", cond))
31 if err != nil {
32 t.Fatal(err)
33 }
34 out := format(stmt)
35 assertContains(t, out, "LEFT JOIN")
36 assertContains(t, out, "orders")
37}
38
39func TestRemoveJoin(t *testing.T) {
40 stmt := mustParse(t, "SELECT * FROM users INNER JOIN orders ON orders.user_id = users.id")

Callers

nothing calls this directly

Calls 5

mustParseFunction · 0.85
ApplyFunction · 0.85
AddJoinFunction · 0.85
assertContainsFunction · 0.85
formatFunction · 0.70

Tested by

no test coverage detected