Skip to content

Commit

Permalink
Merge pull request #1 from billy1624/pr/1052
Browse files Browse the repository at this point in the history
Escape rust keyword when generating conjunct relation impl
  • Loading branch information
andy128k authored Sep 20, 2022
2 parents 750235a + 73e46b7 commit 1fb8ba9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sea-orm-codegen/src/entity/conjunct_relation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use heck::{CamelCase, SnakeCase};
use proc_macro2::Ident;
use quote::format_ident;

use crate::util::escape_rust_keyword;

#[derive(Clone, Debug)]
pub struct ConjunctRelation {
pub(crate) via: String,
Expand All @@ -10,11 +12,11 @@ pub struct ConjunctRelation {

impl ConjunctRelation {
pub fn get_via_snake_case(&self) -> Ident {
format_ident!("{}", self.via.to_snake_case())
format_ident!("{}", escape_rust_keyword(self.via.to_snake_case()))
}

pub fn get_to_snake_case(&self) -> Ident {
format_ident!("{}", self.to.to_snake_case())
format_ident!("{}", escape_rust_keyword(self.to.to_snake_case()))
}

pub fn get_to_camel_case(&self) -> Ident {
Expand Down

0 comments on commit 1fb8ba9

Please sign in to comment.