1db30b92c2
Signed-off-by: Anton Nesterov <anton@demiurg.io>
27 lines
491 B
Go
27 lines
491 B
Go
package builder
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestConvertInsert(t *testing.T) {
|
|
ctx := SQLiteContext{
|
|
TableName: "test",
|
|
TableAlias: "t",
|
|
}
|
|
insert := []Map{
|
|
{"a": "1", "b": 2},
|
|
{"b": 2, "a": "1", "c": 3},
|
|
}
|
|
result, _ := ConvertInsert(ctx, insert)
|
|
|
|
if result.Statement != `INSERT INTO test (a,b,c) VALUES (?,?,?)` {
|
|
t.Errorf(`Expected "INSERT INTO test (a,b,c) VALUES (?,?,?)", got %s`, result.Statement)
|
|
}
|
|
|
|
// for _, r := range result.Values {
|
|
// fmt.Println(r)
|
|
// }
|
|
|
|
}
|