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

Is there a macro to modify the name of the field in sturct? #462

Open
aohanhe opened this issue Nov 15, 2023 · 4 comments
Open

Is there a macro to modify the name of the field in sturct? #462

aohanhe opened this issue Nov 15, 2023 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@aohanhe
Copy link

aohanhe commented Nov 15, 2023

以下面的代码为例:
`
struct TestData{
pub cmd_type: u16
}

`
原来数据库已经把这个字段命名为type了,如果字段名改为type就与关键字冲突了,我想把cmd_type对应上type字段,请问有对应的宏定义吗?
另有没有定义来申明字段为自增长主键?

@Issues-translate-bot
Copy link
Collaborator

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Take the following code as an example:
`
struct TestData{
pub cmd_type: u16
}

`
It turns out that the database has already named this field type. If the field name is changed to type, it will conflict with the keyword. I want to map cmd_type to the type field. Is there a corresponding macro definition?
Is there any definition to declare the field as an auto-increasing primary key?

@Issues-translate-bot Issues-translate-bot changed the title 请问是否有宏来修改sturct中字段的名称? Is there a macro to modify the name of the field in sturct? Nov 15, 2023
@zhuxiujia
Copy link
Member

以下面的代码为例: ` struct TestData{ pub cmd_type: u16 }

` 原来数据库已经把这个字段命名为type了,如果字段名改为type就与关键字冲突了,我想把cmd_type对应上type字段,请问有对应的宏定义吗? 另有没有定义来申明字段为自增长主键?

r#type: u16

@zhuxiujia zhuxiujia added the help wanted Extra attention is needed label Nov 16, 2023
@Issues-translate-bot
Copy link
Collaborator

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Take the following code as an example: ` struct TestData{ pub cmd_type: u16 }

` It turns out that the database has named this field type. If the field name is changed to type, it will conflict with the keyword. I want to map cmd_type to the type field. Is there a corresponding macro definition? Is there any definition to declare the field as an auto-increasing primary key?

r#type: u16

@aohanhe
Copy link
Author

aohanhe commented Nov 21, 2023

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants