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

Name of relation method doesn't consider reverse relation #31

Closed
billy1624 opened this issue Aug 4, 2022 · 2 comments
Closed

Name of relation method doesn't consider reverse relation #31

billy1624 opened this issue Aug 4, 2022 · 2 comments

Comments

@billy1624
Copy link
Member

As a result some generated relation method are not prefixed with its own table name

For example,

pub async fn artist_artists<'a>(
&self,
ctx: &async_graphql::Context<'a>,
) -> crate::orm::artists::Model {
let data_loader = ctx
.data::<async_graphql::dataloader::DataLoader<OrmDataloader>>()
.unwrap();
let key = ArtistArtistsFK(self.artist_id.clone());
let data: Option<_> = data_loader.load_one(key).await.unwrap();
data.unwrap()
}

Such behaviour can be changed at

let key_items: Vec<TokenStream> = source_columns
.iter()
.map(|col: &ColumnMeta| {
col.snake_case_ident()
})
.collect();

@billy1624 billy1624 changed the title Relation method name doesn't consider reverse relation Name of relation method doesn't consider reverse relation Aug 4, 2022
@karatakis
Copy link
Collaborator

Thanks for feedback. I will do some research and make it more friendly.

@karatakis
Copy link
Collaborator

Fixed on this commit be0c7a6

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