2024-08-09 19:14:28 +00:00
|
|
|
package builder
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestConvertUpdate(t *testing.T) {
|
2024-08-15 07:06:11 +00:00
|
|
|
ctx := CommonDialect{
|
2024-08-09 19:14:28 +00:00
|
|
|
TableName: "test",
|
|
|
|
TableAlias: "t",
|
|
|
|
FieldName: "test",
|
|
|
|
}
|
2024-08-09 22:33:10 +00:00
|
|
|
result := convertUpdate(ctx, Map{
|
2024-08-09 19:14:28 +00:00
|
|
|
"c": nil,
|
|
|
|
"a": 1,
|
|
|
|
"b": 2,
|
|
|
|
})
|
|
|
|
if result.Statement != `UPDATE test SET a = ?,b = ?,c = ?` {
|
|
|
|
t.Errorf(`Expected "UPDATE test SET a = ?,b = ?,c = ?", got %s`, result.Statement)
|
|
|
|
}
|
|
|
|
}
|