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

Feature : derive(Insertable) into multiple tables #1314

Open
Zsarl opened this Issue Nov 28, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@Zsarl

Zsarl commented Nov 28, 2017

I'm currently trying to use the same struct in many tables and was looking for something like this:

#[derive(Insertable)]
#[table_name="table1", "table2"]

instead of having to make separate structs for each table. Keep up the good work!

@sgrif

This comment has been minimized.

Member

sgrif commented Nov 28, 2017

Ironically this used to work, but was removed when insertable_into was changed to derive(Insertable_. This has come up enough times that it's worth pursuing (I don't like the idea of giving multiple arguments to table_name, I think this needs a more explicit API.) Happy to do the legwork of implementing if someone proposes an API that seems reasonable.

Since this is not a feature that will require a breaking change, it is on hold until after 1.0.

@Zsarl

This comment has been minimized.

Zsarl commented Nov 29, 2017

Thanks for the response.
The first thing I tried was actually multiple table_name statements - maybe this is more intuitive:

#[derive(Insertable)]
#[table_name="table1"]
#[table_name="table2"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment