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 Table on the generated Column enum #356

Closed
Sytten opened this issue Dec 3, 2021 · 3 comments · Fixed by #360
Closed

Add Table on the generated Column enum #356

Sytten opened this issue Dec 3, 2021 · 3 comments · Fixed by #360

Comments

@Sytten
Copy link
Contributor

Sytten commented Dec 3, 2021

This might seem weird, but it comes from a legit need to no change hundreds of lines of sea-query code.
Currently we have a lot of enums like:

#[derive(Iden, Clone)]
pub enum InterceptEntries {
    Table,
    Id,
    RequestId,
}

That we use like:

Query::select()
.column((InterceptEntries::Table, InterceptEntries::Id))
.column((InterceptEntries::Table, InterceptEntries::RequestId))
.from(InterceptEntries::Table)
// Wayyyy more code 

We want to use sea-orm for all the most simple use cases, but doing so would imply having to change all the InterceptEntries::Table to intercept_entries::Entity and InterceptEntries::Id to intercept_entries::Column::Id.
That is a lot of code for us.

A smoother transition would be to just change the import:

use entities::intercept_entries::Column as InterceptEntries;

But it would require the Column enum to have a Table field.

Maybe this could be a flag only for people that need it?

@billy1624
Copy link
Member

As discussed on Discord. It's doable and we should implement it :P

@tyt2y3
Copy link
Member

tyt2y3 commented Dec 7, 2021

Great, and thanks for the PR

@tyt2y3
Copy link
Member

tyt2y3 commented Dec 12, 2021

0.4.2

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 a pull request may close this issue.

3 participants