Add statements debug sql support.

This commit is contained in:
zer0sub 2019-05-12 18:15:23 +02:00
parent 439c9f1ef9
commit 240ddd65e6
27 changed files with 1013 additions and 426 deletions

View file

@ -1,6 +1,7 @@
package sqlbuilder
import (
"fmt"
"gotest.tools/assert"
"testing"
)
@ -14,5 +15,10 @@ func TestDeleteWithWhere(t *testing.T) {
sql, _, err := table1.DELETE().WHERE(table1Col1.EqL(1)).Sql()
assert.NilError(t, err)
assert.Equal(t, sql, "DELETE FROM db.table1 WHERE table1.col1 = $1;")
fmt.Println(sql)
expectedSql := `
DELETE FROM db.table1
WHERE table1.col1 = $1;
`
assert.Equal(t, sql, expectedSql)
}