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

Upgrading to syn v2 #1713

Merged
merged 8 commits into from
Jun 26, 2023
Merged

Upgrading to syn v2 #1713

merged 8 commits into from
Jun 26, 2023

Conversation

darkmmon
Copy link
Contributor

@darkmmon darkmmon commented Jun 20, 2023

PR Info

New Features

  • upgraded the codes to utilize syn v2

Breaking Changes

  • Drop the use of #[sea_orm(table_name = "col_name")] in DeriveColumn

Changes

@billy1624
Copy link
Member

A Note to self: we should upgrade strum dependency to 0.25
https://github.com/Peternator7/strum/blob/master/CHANGELOG.md#0250

@tyt2y3
Copy link
Member

tyt2y3 commented Jun 21, 2023

@darkmmon can you give a hint/guess on what's not working ?

@darkmmon
Copy link
Contributor Author

I know that it should be some issue about the macro syntax being changed by syn 2
Thanks @billy1624 for giving some advice to me but i'm still looking into them
Hopefully would be able to solve the previous errors with the suggestions

@darkmmon darkmmon mentioned this pull request Jun 23, 2023
4 tasks
Comment on lines 38 to 41
if let Ok(list) = attr.parse_args_with(Punctuated::<Meta, Comma>::parse_terminated)
{
for meta in list.iter() {
if let Meta::NameValue(nv) = meta {
if let Some(name) = nv.path.get_ident() {
if name == "column_name" {
if let Lit::Str(litstr) = &nv.lit {
column_name = litstr.value();
}
}
if name == "table_name" {
if let Lit::Str(litstr) = &nv.lit {
column_name = litstr.value();
}
}
}
}
attr.parse_nested_meta(|meta| {
if meta.path.is_ident("column_name") || meta.path.is_ident("table_name") {
column_name = meta.value()?.parse::<LitStr>()?.value();
} else {
// Reads the value expression to advance the parse stream.
// Some parameters, such as `primary_key`, do not have any value,
// so ignoring an error occurred here.
let _: Option<Expr> = meta.value().and_then(|v| v.parse()).ok();
Copy link
Member

Choose a reason for hiding this comment

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

For some reason, we both #[sea_orm(column_name = "col_name")] and #[sea_orm(table_name = "col_name")] override the str value of column iden.

We should drop the use of #[sea_orm(table_name = "col_name")]

1fba661

@darkmmon darkmmon marked this pull request as ready for review June 26, 2023 03:51
Copy link
Member

@billy1624 billy1624 left a comment

Choose a reason for hiding this comment

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

Thanks!! @darkmmon

A special shout-out to @siketyan for laying the ground #1559

@billy1624 billy1624 requested a review from tyt2y3 June 26, 2023 04:35
Copy link
Member

@tyt2y3 tyt2y3 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 for the effort

@tyt2y3 tyt2y3 merged commit 64342b1 into SeaQL:master Jun 26, 2023
@github-actions
Copy link

github-actions bot commented Aug 2, 2023

🎉 Released In 0.12.1 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

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.

Time to upgrade to SYN 2
3 participants