Skip to content
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

Issue/1953 feat: Add custom operator to Criteria. #1954

Conversation

Wuzhengyu97
Copy link

@Wuzhengyu97 Wuzhengyu97 commented Dec 6, 2024

Solving #1953 issue
This PR introduces support for custom comparators in the Spring Data Relational library, enhancing the flexibility of query building.

Key Changes

  1. Enhanced Comparator
    - Added two new fields:
    - customRenderValueFunc: A function to define custom rendering logic for values.
    - customComparator: A string to define the custom comparator operator.
    - Introduced a setCustomComparator method to configure these properties.
    - Moved the render logic from Criteria to Comparator for better encapsulation and extensibility.
  2. Added Custom Comparator Support in CriteriaStep

@Wuzhengyu97 Wuzhengyu97 closed this Dec 6, 2024
@Wuzhengyu97 Wuzhengyu97 changed the title Issue/1828 Issue/1953 feat: Add custom operator to Criteria. Dec 6, 2024
@Wuzhengyu97 Wuzhengyu97 reopened this Dec 6, 2024
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 6, 2024
@schauder schauder self-assigned this Dec 6, 2024
@schauder schauder added the type: enhancement A general enhancement label Dec 6, 2024
@Wuzhengyu97 Wuzhengyu97 force-pushed the feature/1953-custom-operator-for-criteria branch from 53750e1 to a1e83f1 Compare December 6, 2024 11:05
@Wuzhengyu97
Copy link
Author

I realize that my current implementation has problems in concurrent scenarios, and customComparator might lead to data inconsistency. Perhaps using ConcurrentHashMap to store these values would be a better choice. Or do you have a better solution?
@schauder

@Wuzhengyu97
Copy link
Author

@schauder @mp911de
HI, guys.
Perhaps I could do something to help move this PR forward. Apart from the concurrency issue, I would like to confirm whether my changes are reasonable.

I have extracted the logic of renderValue into the Comparator. I believe renderValue is strongly correlated with each comparator, so it makes sense to have it managed by the Comparator enum. However, I would love to hear your thoughts on this.

I would greatly appreciate it if you could share your feedback. Thank you in advance!

@schauder
Copy link
Contributor

schauder commented Dec 12, 2024

Why are you closing the PR, if I may ask?

@Wuzhengyu97
Copy link
Author

@schauder
There might be some issues with the implementation of the custom operator in this PR. I'll take some time to reconsider and provide a more refined version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants