Add ILIKE for Postgres (case-insensitive LIKE) #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @jeremychone,
First of all, thank you for your excellent work on maintaining the modql crate!
I needed to perform a case-insensitive search using modql, but I couldn't find a way to do this directly. I noticed that sea-query includes support for the ILIKE operator, so I decided to add this functionality to modql.
Summary
This PR introduces support for the ILIKE operator, which is particularly useful for case-insensitive pattern matching in PostgreSQL. This feature is optional and can be enabled by using the
with-ilike
feature flag inCargo.toml
. Additionally, I have added several other case-insensitive operators for more comprehensive support.Changes
ContainsCi(String)
,NotContainsCi(String)
,StartsWithCi(String)
,NotStartsWithCi(String)
,EndsWithCi(String)
,NotEndsWithCi(String)
, andIlike(String)
variants.into_sea_cond_expr
method to handle the new operators.PgBinOper
is only used when thewith-ilike
feature is enabled.Usage
To use the
ILIKE
operator and other case-insensitive operators, ensure thewith-ilike
feature is enabled in yourCargo.toml
:Example of using the
$containsCi
operator in a filter:Feedback
I believe this feature could be beneficial to other users as well. Please let me know if there are any changes or additions you would like me to make to this PR.
Thanks again for your hard work and for considering this addition!
Best regards,
Marc