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

Common field processing issues #512

Open
TTTq opened this issue Apr 4, 2024 · 2 comments
Open

Common field processing issues #512

TTTq opened this issue Apr 4, 2024 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@TTTq
Copy link

TTTq commented Apr 4, 2024

Hello author, I'm not sure if it's possible to add a universal structure processing method. I encountered a problem while using it. I put the common fields create_time, create_id, update_time, and update_id in a BaseModel structure and used them in the structure I'm using. However, when querying the returned value, I won't be able to retrieve and map all the values in this BaseMode structure to the corresponding base field. Is there a solution like this?
`
pub struct BaseModel {
pub create_time: Option,
pub create_id: Option,
pub update_time: Option,
pub update_id: Option,
}

pub struct SubModel{
pub base: Option,
pub user_name: Option,
pub real_name: Option,
pub available: Option,
}
`

@zhuxiujia zhuxiujia added the help wanted Extra attention is needed label Apr 4, 2024
@zhuxiujia
Copy link
Member

Hello author, I'm not sure if it's possible to add a universal structure processing method. I encountered a problem while using it. I put the common fields create_time, create_id, update_time, and update_id in a BaseModel structure and used them in the structure I'm using. However, when querying the returned value, I won't be able to retrieve and map all the values in this BaseMode structure to the corresponding base field. Is there a solution like this? ` pub struct BaseModel { pub create_time: Option, pub create_id: Option, pub update_time: Option, pub update_id: Option, }

pub struct SubModel{ pub base: Option, pub user_name: Option, pub real_name: Option, pub available: Option, } `

see https://github.com/rbatis/rbatis/blob/master/example/src/table_extend.rs

@TTTq
Copy link
Author

TTTq commented Apr 18, 2024

Thinks! But I encountered another plugin executing the modified SQL, and at the end of the execution, it was not the modified SQL, but the SQL before the modification. May I ask why this is?
image
image

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

2 participants