mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
entc/predicate: add isnull/notnull predicates for codegen
Reviewed By: idoshveki Differential Revision: D16687226 fbshipit-source-id: 14a39e066447dbf77413e5c7f7318a2d61bddd32
This commit is contained in:
committed by
Facebook Github Bot
parent
23059c8bae
commit
25f5a2ef01
@@ -191,6 +191,17 @@ func TestBuilder(t *testing.T) {
|
||||
Where(NotNull("parent_id")),
|
||||
wantQuery: "DELETE FROM `users` WHERE `parent_id` IS NOT NULL",
|
||||
},
|
||||
{
|
||||
input: Delete("users").
|
||||
Where(IsNull("parent_id")),
|
||||
wantQuery: "DELETE FROM `users` WHERE `parent_id` IS NULL",
|
||||
},
|
||||
{
|
||||
input: Delete("users").
|
||||
Where(IsNull("parent_id").And().NotIn("name", "foo", "bar")),
|
||||
wantQuery: "DELETE FROM `users` WHERE `parent_id` IS NULL AND `name` NOT IN (?, ?)",
|
||||
wantArgs: []interface{}{"foo", "bar"},
|
||||
},
|
||||
{
|
||||
input: Delete("users").
|
||||
Where(False().And().False()),
|
||||
|
||||
Reference in New Issue
Block a user