jet/tests/mysql/update_dvds_test.go
Eli Ribble 41fe97d336
Fix the imports I botched really badly
Apparently I don't understand how go modules work.
2026-05-14 20:56:20 +00:00

25 lines
716 B
Go

package mysql
import (
"testing"
"source.gleipnir.technology/Gleipnir/jet/v2/internal/testutils"
. "source.gleipnir.technology/Gleipnir/jet/v2/mysql"
. "source.gleipnir.technology/Gleipnir/jet/v2/tests/.gentestdata/mysql/dvds/table"
)
func TestUpdateWithJoin(t *testing.T) {
statement := Staff.INNER_JOIN(Address, Address.AddressID.EQ(Staff.AddressID)).
UPDATE(Staff.LastName).
SET(String("New staff name")).
WHERE(Staff.StaffID.EQ(Int(1)))
testutils.AssertStatementSql(t, statement, `
UPDATE dvds.staff
INNER JOIN dvds.address ON (address.address_id = staff.address_id)
SET last_name = ?
WHERE staff.staff_id = ?;
`, "New staff name", int64(1))
testutils.AssertExecAndRollback(t, statement, db)
}