-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Implement starts_with, ends_with, contains, like, not_like operations on StringFilter and add is_not_null operation #116
Conversation
…on StringFilter and add is_not_null operation
fn contains(&self) -> Option<String> { | ||
panic!("FilterType does not support contains") | ||
None | ||
} | ||
|
||
fn starts_with(&self) -> Option<String> { | ||
panic!("FilterType does not support starts_with") | ||
None | ||
} | ||
|
||
fn ends_with(&self) -> Option<String> { | ||
panic!("FilterType does not support ends_with") | ||
None | ||
} | ||
|
||
fn like(&self) -> Option<String> { | ||
panic!("FilterType does not support like") | ||
None | ||
} | ||
|
||
fn not_like(&self) -> Option<String> { | ||
panic!("FilterType does not support not_like") | ||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Design choice: no-operation or a explicit panic.
I second the no-operation as changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so if I understand you correctly that means that you prefer no-operation and I should keep these changes? 😄
pub is_null: Option<bool>, | ||
pub is_not_null: Option<bool>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A strange question. What if one supply false
for these two fields?
{
customer(
filters: { active: {
# Normally...
is_null: true,
is_not_null: true,
# How about...?
is_null: false,
is_not_null: false,
} }
) {
...
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed.
derive/src/filter.rs
Outdated
condition = condition.add(Column::#column_enum_name.is_null()) | ||
} | ||
} | ||
|
||
if let Some(is_not_null_value) = seaography::FilterTrait::is_not_null(#column_name) { | ||
if is_not_null_value { | ||
condition = condition.add(Column::#column_enum_name.is_not_null()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If one can supply a false
value to is_null
and is_not_null
. Then, we better handle it properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Hey @skopz356, thanks again for contributing!! Sorry for the delay |
@billy1624 Thank you for your review! I will look at your suggestions. I have a question I also thought about implementing these methods (contains, like, etc) on integer and float types. What is your opinion on that? Should it be there or not |
Hey @skopz356, sorry for the delay. I think the |
Implement starts_with, ends_with, contains, like, not_like operations on StringFilter and add is_not_null operation
PR Info
New Features
Changes