Skip to content

Conversation

@xsahil03x
Copy link
Member

This commit enhances the Stream Core library by introducing a new, type-safe approach to defining filters

Filter Enhancements:

  • Introduced FilterField as an extension type for compile-time type safety in field definitions.
  • Reworked Filter class to be generic (Filter<F extends FilterField>), ensuring type safety and clarity.
  • Implemented specific operator classes (e.g., EqualOperator, AndOperator) that extend the base Filter class, providing a structured and type-safe way to build complex queries.
  • Added factory constructors to Filter (e.g., Filter.equal, Filter.and) for a more fluent and readable API when creating filters.
  • Updated FilterOperator to use an extension type for better type safety and organization.
  • Replaced the old Filter implementation with a new, more robust and type-safe system.

Sort Enhancements:

  • Improved documentation and clarity for Sort, SortField, SortDirection, and NullOrdering.
  • Ensured consistency in how sort operations are defined and used.

General Changes:

  • Updated tests to reflect the new filter and sort implementations, ensuring comprehensive coverage and correctness.
  • Improved overall code documentation and type annotations for better maintainability and developer experience.

These changes provide a more robust, type-safe, and developer-friendly way to construct queries, reducing potential runtime errors and improving code readability.

This commit enhances the Stream Core library by introducing a new, type-safe approach to defining filters

**Filter Enhancements:**
- Introduced `FilterField` as an extension type for compile-time type safety in field definitions.
- Reworked `Filter` class to be generic (`Filter<F extends FilterField>`), ensuring type safety and clarity.
- Implemented specific operator classes (e.g., `EqualOperator`, `AndOperator`) that extend the base `Filter` class, providing a structured and type-safe way to build complex queries.
- Added factory constructors to `Filter` (e.g., `Filter.equal`, `Filter.and`) for a more fluent and readable API when creating filters.
- Updated `FilterOperator` to use an extension type for better type safety and organization.
- Replaced the old `Filter` implementation with a new, more robust and type-safe system.

**Sort Enhancements:**
- Improved documentation and clarity for `Sort`, `SortField`, `SortDirection`, and `NullOrdering`.
- Ensured consistency in how sort operations are defined and used.

**General Changes:**
- Updated tests to reflect the new filter and sort implementations, ensuring comprehensive coverage and correctness.
- Improved overall code documentation and type annotations for better maintainability and developer experience.

These changes provide a more robust, type-safe, and developer-friendly way to construct queries, reducing potential runtime errors and improving code readability.
@xsahil03x xsahil03x requested a review from a team as a code owner September 5, 2025 13:02
@codecov
Copy link

codecov bot commented Sep 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.05%. Comparing base (5acdcb8) to head (9f595d2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
+ Coverage   83.95%   87.05%   +3.10%     
==========================================
  Files           5        4       -1     
  Lines         162      170       +8     
==========================================
+ Hits          136      148      +12     
+ Misses         26       22       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xsahil03x xsahil03x merged commit 280b104 into main Sep 5, 2025
7 checks passed
@xsahil03x xsahil03x deleted the feat/type-safe-filters branch September 5, 2025 13:11
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.

3 participants