@@ -580,13 +580,13 @@ static List<Arguments> jooqConditionsSource() {
580580 "not in list of invalid open UUID" ,
581581 """
582582 {"openUUIDField": {"$nin": ["invalid-uuid", "invalid-uuid-2"]}}""" ,
583- field ( "openUUIDField" ). isNull ().or (DSL .trueCondition (). and ( DSL . trueCondition () ))
583+ ( DSL . trueCondition ().and (DSL .trueCondition ())). or ( field ( "openUUIDField" ). isNull ( ))
584584 ),
585585 Arguments .of (
586586 "not in list of invalid ranged UUID" ,
587587 """
588588 {"rangedUUIDField": {"$nin": ["invalid-uuid", "invalid-uuid-2"]}}""" ,
589- field ( "rangedUUIDField" ). isNull ().or (DSL .trueCondition (). and ( DSL . trueCondition () ))
589+ ( DSL . trueCondition ().and (DSL .trueCondition ())). or ( field ( "rangedUUIDField" ). isNull ( ))
590590 ),
591591 Arguments .of (
592592 "in list of partially invalid ranged UUID" ,
@@ -651,15 +651,16 @@ static List<Arguments> jooqConditionsSource() {
651651 "not in list ranged UUID" ,
652652 """
653653 {"rangedUUIDField": {"$nin": ["69939c9a-aa96-440a-a873-3b48f3f4f608", "69939c9a-aa96-440a-a873-3b48f3f4f602"]}}""" ,
654- field ( "rangedUUIDField" ). isNull (). or (cast (field ("rangedUUIDField" ), UUID .class ).ne (cast (inline (UUID .fromString ("69939c9a-aa96-440a-a873-3b48f3f4f608" )), UUID .class )).
654+ (cast (field ("rangedUUIDField" ), UUID .class ).ne (cast (inline (UUID .fromString ("69939c9a-aa96-440a-a873-3b48f3f4f608" )), UUID .class )).
655655 and (cast (field ("rangedUUIDField" ), UUID .class ).ne (cast (inline (UUID .fromString ("69939c9a-aa96-440a-a873-3b48f3f4f602" )), UUID .class ))))
656+ .or (field ("rangedUUIDField" ).isNull ())
656657 ),
657658 Arguments .of (
658659 "not in list open UUID" ,
659660 """
660661 {"openUUIDField": {"$nin": ["69939c9a-aa96-440a-a873-3b48f3f4f608", "invalid-uuid-2"]}}""" ,
661- field ( "openUUIDField" ). isNull (). or (cast (field ("openUUIDField" ), UUID .class ).ne (cast (inline (UUID .fromString ("69939c9a-aa96-440a-a873-3b48f3f4f608" )), UUID .class ))
662- .and (trueCondition ))
662+ (cast (field ("openUUIDField" ), UUID .class ).ne (cast (inline (UUID .fromString ("69939c9a-aa96-440a-a873-3b48f3f4f608" )), UUID .class ))
663+ .and (trueCondition )). or ( field ( "openUUIDField" ). isNull ())
663664 ),
664665 Arguments .of (
665666 "validated field" ,
@@ -693,11 +694,11 @@ static List<Arguments> jooqConditionsSource() {
693694 .and (field ("field5" ).notEqual (5 ).or (field ("field5" ).isNull ()))
694695 .and (field ("field5" ).greaterThan (9 ))
695696 .and (
696- field ( "field3" ). isNull (). or (
697+ (
697698 and (
698699 field ("field3" ).notEqualIgnoreCase ("value1" ),
699700 field ("field3" ).notEqualIgnoreCase ("value2" )
700- )
701+ ). or ( field ( "field3" ). isNull ())
701702 )
702703 )
703704 ),
@@ -727,24 +728,23 @@ static List<Arguments> jooqConditionsSource() {
727728 .and (field ("field5" ).notEqual (5 ).or (field ("field5" ).isNull ()))
728729 .and (field ("field5" ).greaterThan (9 ))
729730 .and (
730- field ("field3" ).isNull ().or (
731- and (
732- field ("field3" ).notEqualIgnoreCase ("value1" ),
733- field ("field3" ).notEqualIgnoreCase ("value2" )
734- )
735- )
731+ and (
732+ field ("field3" ).notEqualIgnoreCase ("value1" ),
733+ field ("field3" ).notEqualIgnoreCase ("value2" )
734+ ).or (field ("field3" ).isNull ())
736735 )
737736 ),
738737 Arguments .of (
739738 "not in list" ,
740739 """
741740 {"field1": {"$nin": ["value1", 2, true]}}""" ,
742- field ( "field1" ). isNull (). or (
741+ or (
743742 and (
744743 field ("field1" ).notEqualIgnoreCase ("value1" ),
745744 field ("field1" ).notEqual (2 ),
746745 field ("field1" ).notEqual (true )
747- )
746+ ),
747+ field ("field1" ).isNull ()
748748 )
749749 ),
750750 Arguments .of (
@@ -820,16 +820,18 @@ static List<Arguments> jooqConditionsSource() {
820820 "array field nin string" ,
821821 """
822822 {"arrayField": {"$nin": ["Some vALUE"]}}""" ,
823- field ("arrayField" ).isNull ().or (
824- not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array ("Some vALUE" ), String [].class )))
823+ or (
824+ not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array ("Some vALUE" ), String [].class ))),
825+ field ("arrayField" ).isNull ()
825826 )
826827 ),
827828 Arguments .of (
828829 "array field nin numeric" ,
829830 """
830831 {"arrayField": {"$nin": [10]}}""" ,
831- field ("arrayField" ).isNull ().or (
832- not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array (10 ), String [].class )))
832+ or (
833+ not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array (10 ), String [].class ))),
834+ field ("arrayField" ).isNull ()
833835 )
834836 ),
835837 Arguments .of (
@@ -845,11 +847,12 @@ static List<Arguments> jooqConditionsSource() {
845847 "nin for jsonb array" ,
846848 """
847849 {"jsonbArrayField": {"$nin": ["value1", "value2"]}}""" ,
848- field ( "jsonbArrayField" ). isNull (). or (
850+ or (
849851 and (
850852 DSL .condition ("NOT({0} @> {1}::jsonb)" , field ("jsonbArrayField" ).cast (JSONB .class ), DSL .inline ("[\" value1\" ]" )),
851853 DSL .condition ("NOT({0} @> {1}::jsonb)" , field ("jsonbArrayField" ).cast (JSONB .class ), DSL .inline ("[\" value2\" ]" ))
852- )
854+ ),
855+ field ("jsonbArrayField" ).isNull ()
853856 )
854857 ),
855858
@@ -879,11 +882,12 @@ static List<Arguments> jooqConditionsSource() {
879882 .and (field ("field5" ).notEqual (5 ).or (field ("field5" ).isNull ()))
880883 .and (field ("field5" ).greaterThan (9 ))
881884 .and (
882- field ( "field3" ). isNull (). or (
885+ or (
883886 and (
884887 field ("field3" ).notEqualIgnoreCase ("value1" ),
885888 field ("field3" ).notEqualIgnoreCase ("value2" )
886- )
889+ ),
890+ field ("field3" ).isNull ()
887891 )
888892 )
889893 ),
@@ -922,12 +926,13 @@ static List<Arguments> jooqConditionsSource() {
922926 "not-in operator on a field with a valueFunction" ,
923927 """
924928 {"fieldWithAValueFunction": {"$nin": ["value1", 2, true]}}""" ,
925- field ( "fieldWithAValueFunction" ). isNull (). or (
929+ or (
926930 and (
927931 field ("fieldWithAValueFunction" ).notEqualIgnoreCase (field ("upper(:value)" , String .class , param ("value" , "value1" ))),
928932 field ("fieldWithAValueFunction" ).notEqual (field ("upper(:value)" , String .class , param ("value" , 2 ))),
929933 field ("fieldWithAValueFunction" ).notEqual (field ("upper(:value)" , String .class , param ("value" , true )))
930- )
934+ ),
935+ field ("fieldWithAValueFunction" ).isNull ()
931936 )
932937 ),
933938
@@ -1083,7 +1088,7 @@ static List<Arguments> jooqConditionsSource() {
10831088 )
10841089 .where (
10851090 field ("({0})::text" , String .class , field (name ("value" ))).eq ("null" )
1086- .or (field ("({0})::text" , String .class , field (name ("value" ))).eq ("\" \" " ))
1091+ .or (field ("({0})::text" , String .class , field (name ("value" ))).eq ("\" \" " ))
10871092 )
10881093 )
10891094 )
@@ -1130,66 +1135,72 @@ static List<Arguments> jooqConditionsSource() {
11301135 "not in list array string" ,
11311136 """
11321137 {"arrayField": {"$nin": ["value1", "value2"]}}""" ,
1133- field ( "arrayField" ). isNull (). or (
1138+ or (
11341139 and (
11351140 not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array ("value1" ), String [].class ))),
11361141 not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array ("value2" ), String [].class )))
1137- )
1142+ ),
1143+ field ("arrayField" ).isNull ()
11381144 )
11391145 ),
11401146 Arguments .of (
11411147 "not in list array numeric" ,
11421148 """
11431149 {"arrayField": {"$nin": [123, 456]}}""" ,
1144- field ( "arrayField" ). isNull (). or (
1150+ or (
11451151 and (
11461152 not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array (123 ), String [].class ))),
11471153 not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array (456 ), String [].class )))
1148- )
1154+ ),
1155+ field ("arrayField" ).isNull ()
11491156 )
11501157 ),
11511158 Arguments .of (
11521159 "not in list array boolean" ,
11531160 """
11541161 {"arrayField": {"$nin": [true, false]}}""" ,
1155- field ( "arrayField" ). isNull (). or (
1162+ or (
11561163 and (
11571164 not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array (true ), String [].class ))),
11581165 not (arrayOverlap (cast (field ("arrayField" ), String [].class ), cast (array (false ), String [].class )))
1159- )
1166+ ),
1167+ field ("arrayField" ).isNull ()
11601168 )
11611169 ),
11621170 Arguments .of (
11631171 "not in list jsonb array string" ,
11641172 """
11651173 {"jsonbArrayField": {"$nin": ["value1", "value2"]}}""" ,
1166- field ( "jsonbArrayField" ). isNull (). or (
1174+ or (
11671175 and (
11681176 DSL .condition ("NOT({0} @> {1}::jsonb)" , field ("jsonbArrayField" ).cast (JSONB .class ), DSL .inline ("[\" value1\" ]" )),
11691177 DSL .condition ("NOT({0} @> {1}::jsonb)" , field ("jsonbArrayField" ).cast (JSONB .class ), DSL .inline ("[\" value2\" ]" ))
1170- )
1178+ ),
1179+ field ("jsonbArrayField" ).isNull ()
11711180 )
11721181 ),
11731182 Arguments .of (
11741183 "not in list jsonb array numeric" ,
11751184 """
11761185 {"jsonbArrayField": {"$nin": [123, 456]}}""" ,
1177- field ( "jsonbArrayField" ). isNull (). or (
1186+ or (
11781187 and (
11791188 DSL .condition ("NOT({0} @> {1}::jsonb)" , field ("jsonbArrayField" ).cast (JSONB .class ), DSL .inline ("[\" 123\" ]" )),
11801189 DSL .condition ("NOT({0} @> {1}::jsonb)" , field ("jsonbArrayField" ).cast (JSONB .class ), DSL .inline ("[\" 456\" ]" ))
1181- )
1190+ ),
1191+ field ("jsonbArrayField" ).isNull ()
11821192 )
11831193 ),
11841194 Arguments .of (
11851195 "not in list jsonb array boolean" ,
11861196 """
11871197 {"jsonbArrayField": {"$nin": [true, false]}}""" ,
1188- field ( "jsonbArrayField" ). isNull (). or (
1198+ or (
11891199 and (
11901200 DSL .condition ("NOT({0} @> {1}::jsonb)" , field ("jsonbArrayField" ).cast (JSONB .class ), DSL .inline ("[\" true\" ]" )),
11911201 DSL .condition ("NOT({0} @> {1}::jsonb)" , field ("jsonbArrayField" ).cast (JSONB .class ), DSL .inline ("[\" false\" ]" ))
1192- )
1202+ ),
1203+ field ("jsonbArrayField" ).isNull ()
11931204 )
11941205 ),
11951206 Arguments .of (
@@ -1281,6 +1292,31 @@ static List<Arguments> jooqConditionsSource() {
12811292 cast (UUID .fromString ("df3f3e8a-8694-59ad-ad52-3671613d02dc" ), UUID .class ),
12821293 cast (null , UUID .class )
12831294 ), String [].class ))
1295+ ),
1296+ /// //////////////////////////
1297+ Arguments .of (
1298+ "equals string with matching default value" ,
1299+ """
1300+ {"stringDefaultValue": {"$eq": "default"}}""" ,
1301+ field ("stringDefaultValue" ).equalIgnoreCase ("default" ).or (field ("stringDefaultValue" ).isNull ())
1302+ ),
1303+ Arguments .of (
1304+ "equals string with non-matching default value" ,
1305+ """
1306+ {"stringDefaultValue": {"$eq": "something else"}}""" ,
1307+ field ("stringDefaultValue" ).equalIgnoreCase ("something else" )
1308+ ),
1309+ Arguments .of (
1310+ "not equals string with matching default value" ,
1311+ """
1312+ {"stringDefaultValue": {"$ne": "default"}}""" ,
1313+ field ("stringDefaultValue" ).notEqualIgnoreCase ("default" )
1314+ ),
1315+ Arguments .of (
1316+ "not equals string with non-matching default value" ,
1317+ """
1318+ {"stringDefaultValue": {"$ne": "something else"}}""" ,
1319+ field ("stringDefaultValue" ).notEqualIgnoreCase ("something else" ).or (field ("stringDefaultValue" ).isNull ())
12841320 )
12851321 );
12861322 }
0 commit comments