Renamed generated schema func to UseSchema.
This commit is contained in:
parent
04c1a51ba7
commit
1bf48d640a
6 changed files with 46 additions and 41 deletions
25
tests/mysql/update_dvds_test.go
Normal file
25
tests/mysql/update_dvds_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package mysql
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-jet/jet/v2/internal/testutils"
|
||||
. "github.com/go-jet/jet/v2/mysql"
|
||||
. "github.com/go-jet/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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue