Add support for DELETE statements.
This commit is contained in:
parent
70d6f84375
commit
bc6a2bbcac
14 changed files with 492 additions and 543 deletions
18
sqlbuilder/delete_statement_test.go
Normal file
18
sqlbuilder/delete_statement_test.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package sqlbuilder
|
||||
|
||||
import (
|
||||
"gotest.tools/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDeleteUnconditionally(t *testing.T) {
|
||||
_, err := table1.Delete().String()
|
||||
assert.Assert(t, err != nil)
|
||||
}
|
||||
|
||||
func TestDeleteWithWhere(t *testing.T) {
|
||||
sql, err := table1.Delete().WHERE(table1Col1.EqL(1)).String()
|
||||
assert.NilError(t, err)
|
||||
|
||||
assert.Equal(t, sql, "DELETE FROM db.table1 WHERE table1.col1 = 1;")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue