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

A way to define custom filters #31

Open
HassanAzzam opened this issue Jul 22, 2024 · 3 comments
Open

A way to define custom filters #31

HassanAzzam opened this issue Jul 22, 2024 · 3 comments

Comments

@HassanAzzam
Copy link
Contributor

Currently can't define filters other than the defined in the filter expression visitor class.

It's nice to have custom filters such as subsetof or so, but can't find a clean way to do so.

@dpimonov
Copy link
Contributor

Hi HassanAzzam, сould you please provide a more detailed example of your use case? The current implementation already supports complex filtering and serialization, but maybe I missed something. Thanks in advance!

@HassanAzzam
Copy link
Contributor Author

Have a look at elide.io(a known json api library for Java), there is a list of supported operators for filtering out-of-box(supersetof is my current need). I was wondering if there is any way to inject implementation for these operators in the filter expression visitor class.

@dpimonov
Copy link
Contributor

Got it! The filter expression visitor is a specific interface provided by the entity store. It can be tricky to create custom implementations because it involves a lot of reflection, filter expressions creation and delegation logic to keep things simple for the end user. Usually, you can achieve the same results as with supersetof using or/and filtering. But they do not provide them. The only way by design is to extend an entity store and implement new methods by concrete implementations. Also elide requires its own filter expression visitor on this side of the library.

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

No branches or pull requests

2 participants