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

add some multirange operations support #4261

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

guissalustiano
Copy link
Contributor

@guissalustiano guissalustiano commented Sep 13, 2024

Add multirange contains support under #4240

It is a small test to check the format before moving everything else

@guissalustiano guissalustiano requested a review from a team September 13, 2024 00:29
@guissalustiano guissalustiano changed the title add multirange contains support add some multirange operations support Sep 13, 2024
@@ -1779,7 +1790,7 @@ pub trait PgRangeExpressionMethods: Expression + Sized {
impl<T> PgRangeExpressionMethods for T
where
T: Expression,
T::SqlType: RangeOrNullableRange,
T::SqlType: MultirangeOrRangeMaybeNullable,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't test without flipping this, and this allows all the range operations to accept multirange without proper test. What do the reviewers think? Can I merge the PR like that and add tests in the future in other small PRs, or should I add a multirange test for all the range methods?

Copy link
Member

@weiznich weiznich Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct way to handle this would be to split up this trait into two:

  • The PgRangeExpressionMethods contains methods that are only available for Range but not for MultiRange. That is then only implemented for T::SqlType: RangeOrNullableRange
  • The PgRangeAndMultirangeMethods contains methods that are available for both

(If there are methods that are only available for MultiRange we would just add a third trait for that.)

I would prefer having at least one test for range + one for multirange for each of the supported methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a fast check, and it looks like all the range operations are also multirange operations. If this is the case, do you still want to rename it to PgRangeAndMultirangeMethods?

I will add the tests for each of the supported methods in this PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it should be fine to keep the old name.

@guissalustiano guissalustiano marked this pull request as ready for review September 13, 2024 03:36
@guissalustiano guissalustiano marked this pull request as draft September 13, 2024 13:13
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

Successfully merging this pull request may close these issues.

2 participants