Skip to content

feat: Add support for OR and AND conditions in filtering #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

konradbeck-creditech
Copy link

Pull Request Template for FastCRUD

Description

This PR adds support for or_() and and_() in _parse_filters(), allowing for more flexible filtering when querying records.

Changes

  • Added support for or_() to enable filtering with multiple conditions using logical OR.
  • Introduced and_() to allow explicit AND grouping.
  • Improved error handling for empty lists in or_() and and_().
  • Refactored _parse_filters() for better readability and maintainability.

Tests

  • Added unit tests for or_() to verify multiple condition filtering.
  • Added unit tests for and_() to confirm AND logic works correctly.
  • Included a test combining or_() and and_() to ensure compatibility.
  • Maintained all existing tests without breaking changes.

Checklist

  • [✅] I have read the CONTRIBUTING document.
  • [✅ ] My code follows the code style of this project.
  • [❌] I have added necessary documentation (if appropriate).
  • [✅] I have added tests that cover my changes (if applicable).
  • [✅] All new and existing tests passed.

Additional Notes

This enhancement improves query flexibility while keeping backward compatibility. 🚀

@igorbenav
Copy link
Collaborator

Hey, @konradbeck-creditech, can you please fix the checks?

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.

2 participants