Closed mcamara closed 3 months ago
@mcamara How did you know that I wanted to add the ...Ci
to the string operators? This is awesome!
I was hoping the ...Ci
would be enough and that we wouldn't need a PostgreSQL-specific ILIKE
, but the fact that it’s added as a feature might be okay.
By the way, the Sea-Query update should have been in a separate PR, not part of this one, since I wanted to do it ASAP.
Can you remove it from the PR? (I think you just need to remove the commit and do a force push).
ha, that was part of our previous conversation. Somehow, I did not find the thread.
Ok, did a first scan, and it looks good. I need to double check more.
@mcamara Ok, I merge it as is. This is really good work.
Note: I will add my rustfmt.toml to make sure there is a common whitespace (my bad), but this PR was great.
Big thanks!
@jeremychone thanks to you for your awesome job with these crates and your videos! It was a pleasure to help you!
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