Skip to content

Remove inherent SimpleExpr methods that duplicate ExprTrait#890

Merged
tyt2y3 merged 16 commits intoSeaQL:masterfrom
Huliiiiii:expr-2
Jun 8, 2025
Merged

Remove inherent SimpleExpr methods that duplicate ExprTrait#890
tyt2y3 merged 16 commits intoSeaQL:masterfrom
Huliiiiii:expr-2

Conversation

@Huliiiiii
Copy link
Member

@Huliiiiii Huliiiiii commented May 22, 2025

PR Info

  • Closes

New Features

Bug Fixes

Breaking Changes

  • Remove inherent SimpleExpr methods that duplicate ExprTrait.
    • This also removes these methods from Expr, because Expr has recenly become an alias of SimpleExpr (Unify Expr and SimpleExpr as one type #889)
    • How to migrate:
      • Where the methods are no longer found, just use sea_query::ExprTrait, as the compiler suggests.
      • Where the methods conflict with PartialEq or PartialOrd methods, qualify them as TheTrait::the_method or use Rust's built-in operators.

Changes

@Huliiiiii Huliiiiii mentioned this pull request May 22, 2025
8 tasks
Copy link
Member

@Expurple Expurple left a comment

Choose a reason for hiding this comment

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

cargo test fails, need to add use crate::ExprTrait; where the methods are called (as expected)

Copy link
Member

@Expurple Expurple left a comment

Choose a reason for hiding this comment

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

Many similar methods are still there, you can search for the word "equivalent" in expr.rs

EDIT: ah, sorry, I see. They are all in Expr, which will be deleted separately in #889. But this could still be a problem because of unexpected interactions with that PR. Can you rebase this branch on top of that branch, and then set that branch as a base of this PR on Github? So that here we can see the diff relative to that

@Huliiiiii
Copy link
Member Author

I couldn't switch the base branch to my fork branch, so I created a PR on my fork. The difference is here. Huliiiiii#1

Copy link
Member

@Expurple Expurple left a comment

Choose a reason for hiding this comment

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

Thank you. The diff at Huliiiiii#1 looks amazing. I ran cargo test locally, everything works as expected.

Now we need to check and fix the breakage in sea_orm. Can you make a draft sea_orm PR stacked on top of SeaQL/sea-orm#2604? And an "artificial" PR to see the diff. Everything like in this PR + the temporary Cargo.toml change that I recommended in SeaQL/sea-orm#2604 (review)

@Expurple
Copy link
Member

We can rebase this on top of master. It now has unification

@Expurple
Copy link
Member

Can you fix the CI errors, please?

Copy link
Member

@Expurple Expurple left a comment

Choose a reason for hiding this comment

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

Everything seems good here.

We can resolve the merge conflicts in SeaQL/sea-orm#2606 and check what the CI says there

Copy link
Member

@Expurple Expurple left a comment

Choose a reason for hiding this comment

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

Thank you. Everything seems good in both PRs, the CI passes.

Although, the PR name and changelog look like we're removing methods from ExprTrait. I'd reword it into something like this:

  • Remove inherent SimpleExpr methods that duplicate ExprTrait.
    • How to migrate: where the method calls no longer compile, just use sea_query::ExprTrait, as the compiler suggests.

After that, we can merge this PR and proceed with SeaQL/sea-orm#2606 (review)

@Expurple Expurple changed the title Remove inherent methods of SimpleExpr from ExprTrait Remove inherent SimpleExpr methods that duplicate ExprTrait Jun 4, 2025
Copy link
Member

@Expurple Expurple left a comment

Choose a reason for hiding this comment

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

I've recently become a maintainer, so now I can update your PR descriptions directly. I hope, you don't mind.

@tyt2y3, you can merge this now

@Huliiiiii
Copy link
Member Author

Not at all, Feel free to make any updates you see fit.

@tyt2y3
Copy link
Member

tyt2y3 commented Jun 8, 2025

thank you guys!

@tyt2y3 tyt2y3 merged commit 0268460 into SeaQL:master Jun 8, 2025
20 checks passed
@Huliiiiii Huliiiiii deleted the expr-2 branch August 9, 2025 18:21
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.

3 participants