Skip to content

feat: add IsNull and IsNotNull unary condition operators - #2

Open
AmirTahan80 wants to merge 2 commits into
PepperX-Dev:mainfrom
AmirTahan80:feat/is-null-operators
Open

AmirTahan80 wants to merge 2 commits into
PepperX-Dev:mainfrom
AmirTahan80:feat/is-null-operators

Conversation

@AmirTahan80

Copy link
Copy Markdown
Contributor

Summary

Adds first-class unary null-checking operators (IsNull and IsNotNull) across the entire QueryForge ecosystem.

Callers can now express IS NULL and IS NOT NULL conditions explicitly using dedicated operators without having to pass
ull as a value argument to Equals / NotEquals.

  • ConditionOperator.IsNull (11): Evaluates to true when the column/property is null.
  • ConditionOperator.IsNotNull (12): Evaluates to true when the column/property is not null.

Changes

  • Core (PepperX.QueryForge):

    • Added IsNull (11) and IsNotNull (12) to ConditionOperator enum.
    • Added ConditionSemantics.IsUnaryOperator helper.
    • Updated ConditionSemantics.IsExecutable to allow unary operators to execute without requiring a Value.
    • Implemented evaluation in InMemoryQueryEngine with null-safe three-valued logic.
  • Dapper (PepperX.QueryForge.Dapper):

    • Added IS NULL and IS NOT NULL SQL fragment generation in SqlQueryCompiler.BuildCondition without allocating unnecessary query parameters.
  • EF Core (PepperX.QueryForge.EFCore):

    • Added expression compilation for IsNull and IsNotNull in ExpressionCompiler.BuildCondition.
    • Added inversion logic in BuildNegatedCondition so negations (NOT (col IS NULL)) cleanly invert without invalid EF Core null compensation.
  • Conformance Tests (PepperX.QueryForge.Conformance):

    • Added conformance tests covering nullable columns, non-nullable columns, and negated condition groups.
  • Sample API (PepperX.QueryForge.Sample.WebApi):

    • Updated Requests.http with operator documentation and sample requests # 35a and # 35b.

Verification

All 195 unit and integration tests passing (dotnet test).

- Add ConditionOperator.IsNull (11) and ConditionOperator.IsNotNull (12)
- Update ConditionSemantics to treat IsNull and IsNotNull as executable unary operators without requiring a value parameter
- Implement null-safe evaluation in InMemoryQueryEngine
- Add Dapper SqlQueryCompiler support generating IS NULL and IS NOT NULL predicates
- Add EF Core ExpressionCompiler translation using direct null comparisons and handling negations
- Add comprehensive conformance tests verifying IS NULL / IS NOT NULL behavior across providers
- Add sample requests in Requests.http for In-Memory provider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant