Avoid unnecessary double wrapping of SELECT statement when used as single function parameter.
This commit is contained in:
parent
22b2901336
commit
d197956271
16 changed files with 97 additions and 77 deletions
|
|
@ -121,7 +121,7 @@ func TestUpdateWithModelData(t *testing.T) {
|
|||
stmt := Link.
|
||||
UPDATE(Link.AllColumns).
|
||||
MODEL(link).
|
||||
WHERE(Link.ID.EQ(Int(int64(link.ID))))
|
||||
WHERE(Link.ID.EQ(Int32(link.ID)))
|
||||
|
||||
expectedSQL := `
|
||||
UPDATE test_sample.link
|
||||
|
|
@ -131,7 +131,7 @@ SET id = ?,
|
|||
description = ?
|
||||
WHERE link.id = ?;
|
||||
`
|
||||
testutils.AssertStatementSql(t, stmt, expectedSQL, int32(201), "http://www.duckduckgo.com", "DuckDuckGo", nil, int64(201))
|
||||
testutils.AssertStatementSql(t, stmt, expectedSQL, int32(201), "http://www.duckduckgo.com", "DuckDuckGo", nil, int32(201))
|
||||
|
||||
testutils.AssertExec(t, stmt, db)
|
||||
requireLogged(t, stmt)
|
||||
|
|
@ -152,7 +152,7 @@ func TestUpdateWithModelDataAndPredefinedColumnList(t *testing.T) {
|
|||
stmt := Link.
|
||||
UPDATE(updateColumnList).
|
||||
MODEL(link).
|
||||
WHERE(Link.ID.EQ(Int(int64(link.ID))))
|
||||
WHERE(Link.ID.EQ(Int32(link.ID)))
|
||||
|
||||
var expectedSQL = `
|
||||
UPDATE test_sample.link
|
||||
|
|
@ -161,9 +161,8 @@ SET description = NULL,
|
|||
url = 'http://www.duckduckgo.com'
|
||||
WHERE link.id = 201;
|
||||
`
|
||||
//fmt.Println(stmt.DebugSql())
|
||||
|
||||
testutils.AssertDebugStatementSql(t, stmt, expectedSQL, nil, "DuckDuckGo", "http://www.duckduckgo.com", int64(201))
|
||||
testutils.AssertDebugStatementSql(t, stmt, expectedSQL, nil, "DuckDuckGo", "http://www.duckduckgo.com", int32(201))
|
||||
|
||||
testutils.AssertExec(t, stmt, db)
|
||||
requireLogged(t, stmt)
|
||||
|
|
@ -181,7 +180,7 @@ func TestUpdateWithModelDataAndMutableColumns(t *testing.T) {
|
|||
stmt := Link.
|
||||
UPDATE(Link.MutableColumns).
|
||||
MODEL(link).
|
||||
WHERE(Link.ID.EQ(Int(int64(link.ID))))
|
||||
WHERE(Link.ID.EQ(Int32(link.ID)))
|
||||
|
||||
var expectedSQL = `
|
||||
UPDATE test_sample.link
|
||||
|
|
@ -192,7 +191,7 @@ WHERE link.id = 201;
|
|||
`
|
||||
//fmt.Println(stmt.DebugSql())
|
||||
|
||||
testutils.AssertDebugStatementSql(t, stmt, expectedSQL, "http://www.duckduckgo.com", "DuckDuckGo", nil, int64(201))
|
||||
testutils.AssertDebugStatementSql(t, stmt, expectedSQL, "http://www.duckduckgo.com", "DuckDuckGo", nil, int32(201))
|
||||
testutils.AssertExec(t, stmt, db)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue