Skip to content

Rename doesnt work with query_file_as! #648

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

Closed
leesiongchan opened this issue Aug 20, 2020 · 1 comment
Closed

Rename doesnt work with query_file_as! #648

leesiongchan opened this issue Aug 20, 2020 · 1 comment

Comments

@leesiongchan
Copy link

pub struct A {
  id: i64,
  #[sqlx(rename = "type")]
  pub a_type: i32,
}
SELECT *
FROM a
let a = sqlx::query_file_as!(A, "a.sql").fetch_all(&pool).await?;

it will show error
'xxx' has no field named 'r#type' available fields are: yyy

@abonander
Copy link
Collaborator

The macros can't see attributes on the struct definition, that's not how it works.

However, this will work when #514 is fixed so I'm closing this as duplicate.

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

No branches or pull requests

2 participants