MCPcopy Create free account
hub / github.com/datasweet/datatable / TestLeftJoinWithExpr

Function TestLeftJoinWithExpr

join_test.go:148–166  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

146}
147
148func TestLeftJoinWithExpr(t *testing.T) {
149 customers, orders := sampleForJoin()
150 customers.AddColumn("id2", datatable.Int, datatable.Expr("`id`+100"))
151 orders.AddColumn("user_id2", datatable.Int, datatable.Expr("`user_id`+100"))
152 dt, err := customers.LeftJoin(orders, datatable.On("[Customers].[id2]", "[Orders].[user_id2]"))
153 assert.NoError(t, err)
154 assert.NotNil(t, dt)
155
156 fmt.Println(dt)
157
158 checkTable(t, dt,
159 "id", "prenom", "nom", "email", "ville", "id2", "user_id", "date_achat", "num_facture", "prix_total",
160 1, "Aimée", "Marechal", "aime.marechal@example.com", "Paris", 101, 1, time.Date(2013, time.January, 23, 0, 0, 0, 0, time.UTC), "A00103", 203.14,
161 1, "Aimée", "Marechal", "aime.marechal@example.com", "Paris", 101, 1, time.Date(2013, time.February, 14, 0, 0, 0, 0, time.UTC), "A00104", 124.00,
162 2, "Esmée", "Lefort", "esmee.lefort@example.com", "Lyon", 102, 2, time.Date(2013, time.February, 17, 0, 0, 0, 0, time.UTC), "A00105", 149.45,
163 3, "Marine", "Prevost", "m.prevost@example.com", "Lille", 103, 3, time.Date(2013, time.February, 21, 0, 0, 0, 0, time.UTC), "A00106", 235.35,
164 4, "Luc", "Rolland", "lucrolland@example.com", "Marseille", 104, nil, nil, nil, nil,
165 )
166}
167
168func TestRightJoinWithExpr(t *testing.T) {
169 customers, orders := sampleForJoin()

Callers

nothing calls this directly

Calls 6

ExprFunction · 0.92
OnFunction · 0.92
sampleForJoinFunction · 0.85
checkTableFunction · 0.85
AddColumnMethod · 0.80
LeftJoinMethod · 0.80

Tested by

no test coverage detected