Jaguar-dart / jaguar_orm

Source-generated ORM with relations (one-to-one, one-to-many, many-to-many), preloading, cascading, polymorphic relations, etc
https://jaguar-dart.github.io
BSD 3-Clause "New" or "Revised" License
217 stars 54 forks source link

Implement iss and isNot in where clause #150

Open KamalElShazly opened 5 years ago

KamalElShazly commented 5 years ago

Hello,

I wanted to use iss in a where clause to check for NULL values but it was not recognized. I'm using jaguar_query-2.2.8 and i can't find it in \jaguar_query-2.2.8\lib\src\operators\operators.dart Although i found the implementation in \jaguar_query-2.2.8\lib\src\core\expression\condition.dart and in \jaguar_query-2.2.8\lib\src\core\operators\comparision.dart

I have an easy fix by adding the following in \jaguar_query-2.2.8\lib\src\operators\operators.dart /// DSL to create 'IS' relational condition Cond iss(String field, ValType rhs, {String tableName}) => Cond(Field.inTable(tableName, field), Op.Is, rhs);

/// DSL to create 'IS NOT' relational condition Cond isNot(String field, ValType rhs, {String tableName}) => Cond(Field.inTable(tableName, field), Op.IsNot, rhs);

But i'm not sure which branch is mapped to version 2.2.8 as i can't find the operators folder in master branch.

jaumard commented 4 years ago

Hello,

I'm using this and it works:

return _bean.findWhere(IntField('id').iss(null));

Code is here https://github.com/Jaguar-dart/jaguar_orm/blob/legacyV3/query/lib/src/core/expression/field.dart#L35

It's not anymore in master because master code has been updated to v4 and release version is still v3 for now