Merge pull request #45 from joonash/mysql-not-operator
MySQL NOT operator support
This commit is contained in:
commit
4b0263112f
3 changed files with 31 additions and 5 deletions
|
|
@ -253,8 +253,3 @@ var EXISTS = jet.EXISTS
|
|||
|
||||
// CASE create CASE operator with optional list of expressions
|
||||
var CASE = jet.CASE
|
||||
|
||||
//----------------- Bit operators ---------------//
|
||||
|
||||
// BIT_NOT inverts every bit in integer expression
|
||||
var BIT_NOT = jet.BIT_NOT
|
||||
|
|
|
|||
9
mysql/operators.go
Normal file
9
mysql/operators.go
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
package mysql
|
||||
|
||||
import "github.com/go-jet/jet/v2/internal/jet"
|
||||
|
||||
// NOT returns negation of bool expression result
|
||||
var NOT = jet.NOT
|
||||
|
||||
// BIT_NOT inverts every bit in integer expression result
|
||||
var BIT_NOT = jet.BIT_NOT
|
||||
|
|
@ -132,3 +132,25 @@ FROM db.table1
|
|||
LOCK IN SHARE MODE;
|
||||
`)
|
||||
}
|
||||
|
||||
func TestSelect_NOT_EXISTS(t *testing.T) {
|
||||
testutils.AssertStatementSql(t,
|
||||
SELECT(table1ColInt).
|
||||
FROM(table1).
|
||||
WHERE(
|
||||
NOT(EXISTS(
|
||||
SELECT(table2ColInt).
|
||||
FROM(table2).
|
||||
WHERE(
|
||||
table1ColInt.EQ(table2ColInt),
|
||||
),
|
||||
))), `
|
||||
SELECT table1.col_int AS "table1.col_int"
|
||||
FROM db.table1
|
||||
WHERE (NOT (EXISTS (
|
||||
SELECT table2.col_int AS "table2.col_int"
|
||||
FROM db.table2
|
||||
WHERE table1.col_int = table2.col_int
|
||||
)));
|
||||
`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue