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

Function TestAddReturning_OnInsert

pkg/transform/returning_test.go:21–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestAddReturning_OnInsert(t *testing.T) {
22 stmt := mustParse(t, "INSERT INTO users (name) VALUES ('alice')")
23
24 err := Apply(stmt, AddReturning("id"))
25 if err != nil {
26 t.Fatalf("AddReturning on INSERT: %v", err)
27 }
28
29 out := format(stmt)
30 assertContains(t, out, "RETURNING")
31 assertContains(t, out, "id")
32}
33
34func TestAddReturning_OnUpdate(t *testing.T) {
35 stmt := mustParse(t, "UPDATE users SET status = 'active' WHERE id = 1")

Callers

nothing calls this directly

Calls 6

mustParseFunction · 0.85
ApplyFunction · 0.85
AddReturningFunction · 0.85
assertContainsFunction · 0.85
formatFunction · 0.70
FatalfMethod · 0.65

Tested by

no test coverage detected