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

Implement pgrange union #4135

Merged
merged 6 commits into from
Aug 1, 2024
Merged

Conversation

vijairamg
Copy link

@vijairamg vijairamg commented Jul 27, 2024

Implements anyrange anyrange -> anyrange, anyrange * anyrange -> anyrange and anyrange - anyrange -> anyrange part of #4092

@vijairamg vijairamg force-pushed the pgrange-range-ops branch 13 times, most recently from 1c801d3 to 9bab83e Compare July 28, 2024 02:18
@vijairamg vijairamg changed the title test Implement pgrange union Jul 28, 2024
R: crate::expression::Expression<SqlType = Range<ST>>,
ST: SqlType TypedExpressionType,
{
type SqlType = ST;
Copy link
Member

Choose a reason for hiding this comment

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

That's the problematic line that's causing the error.

You specify here that range_a.union_range(range_b) return the inner type of the range instead. You want type SqlType = Range<ST> instead, which just says that the operator returns a range as well.

That written: You should likely use the infix_operator!() macro instead to generate all this code for you. It should be much easier that way.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the pointer.
My bad! Should have noticed the __diesel_infix_operator!.

@vijairamg vijairamg force-pushed the pgrange-range-ops branch 10 times, most recently from 955c02e to 6b6261f Compare July 30, 2024 22:15
@vijairamg vijairamg requested a review from weiznich August 1, 2024 01:29
@vijairamg
Copy link
Author

Let me know if any of the names need to be changed.

Copy link
Member

@weiznich weiznich left a comment

Choose a reason for hiding this comment

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

Looks good beside the two minor documentation fixes. Thanks for working on this 👍

diesel/src/pg/expression/expression_methods.rs Outdated Show resolved Hide resolved
@weiznich weiznich enabled auto-merge August 1, 2024 18:34
@weiznich weiznich added this pull request to the merge queue Aug 1, 2024
Merged via the queue into diesel-rs:master with commit 4763e7c Aug 1, 2024
49 checks passed
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