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

Query with like operator #1096

Closed
lucas-prestes opened this issue Jun 5, 2021 · 3 comments
Closed

Query with like operator #1096

lucas-prestes opened this issue Jun 5, 2021 · 3 comments
Labels

Comments

@lucas-prestes
Copy link

lucas-prestes commented Jun 5, 2021

Hello everyone, I'm just getting started using JaVers, and wanted first of all to thank you all, it is really easy to use and configure.
There is just one feature I miss though, and that is the ability to use the like operator with the Commit Metadata properties.
Currently I have a commit property I wish to use as filter, the ideal scenario would be the user being able to type any part of said property, eg: Let's say there is a commit property 'name' with the value John Doe, in the use case I was building both 'John' and 'Doe' or even 'John D' would return the same data.
For now I would probably end up filtering this after bringing all the rows from the database, but I think it would be really cool( not to mention having way more performance) if this was part of the JQL spec.
From what I saw from the source code one way it could happen would be having a withCommitPropertyLike in the QueryBuilder class, that would render a 'LIKE %:property%' on the final SQL for the JaversSqlRepository, and it could translate to a simple String.contains for the In memory implementation.

@lucas-prestes
Copy link
Author

Hi again, I was feeling motivated so I played a little with Javers code and implemented this feature using the WithCommitProperty method as an example, and all unit tests are passing, so if its ok with you I can submit a PR

@bartoszwalacik
Copy link
Member

Hi, ok, create a PR, I'd like to see the code

lucas-prestes pushed a commit to lucas-prestes/javers that referenced this issue Jun 7, 2021
…made implementations for InMemoryRepository,MongoRepository and SnapshotQuery, and added unit tests
bartoszwalacik added a commit that referenced this issue Aug 23, 2021
bartoszwalacik added a commit that referenced this issue Aug 23, 2021
@bartoszwalacik
Copy link
Member

released in 6.2.4
@lucas-prestes thanks for this high quality contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants