jet/delete_statement_test.go

18 lines
417 B
Go
Raw Normal View History

2019-06-21 13:56:57 +02:00
package jet
2019-04-20 19:49:29 +02:00
import (
"testing"
)
func TestDeleteUnconditionally(t *testing.T) {
2019-06-16 11:20:44 +02:00
assertStatementErr(t, table1.DELETE(), `deleting without a WHERE clause`)
assertStatementErr(t, table1.DELETE().WHERE(nil), `deleting without a WHERE clause`)
2019-04-20 19:49:29 +02:00
}
func TestDeleteWithWhere(t *testing.T) {
2019-06-16 11:20:44 +02:00
assertStatement(t, table1.DELETE().WHERE(table1Col1.EQ(Int(1))), `
2019-05-12 18:15:23 +02:00
DELETE FROM db.table1
WHERE table1.col1 = $1;
2019-06-16 11:20:44 +02:00
`, int64(1))
2019-04-20 19:49:29 +02:00
}