Entity attr as "table"
This commit is contained in:
parent
62b3c37e20
commit
682d2151fc
@ -1,7 +1,7 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
|
||||
#[entity = "cake"]
|
||||
#[table = "cake"]
|
||||
pub struct Entity;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, DeriveModel)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
|
||||
#[entity = "fruit"]
|
||||
#[table = "fruit"]
|
||||
pub struct Entity;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, DeriveModel)]
|
||||
|
@ -9,7 +9,7 @@ fn get_entity_attr(attrs: &[Attribute]) -> Option<syn::Lit> {
|
||||
Ok(Meta::NameValue(nv)) => nv,
|
||||
_ => continue,
|
||||
};
|
||||
if name_value.path.is_ident("entity") {
|
||||
if name_value.path.is_ident("table") {
|
||||
return Some(name_value.lit);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use syn::{parse_macro_input, DeriveInput};
|
||||
|
||||
mod derives;
|
||||
|
||||
#[proc_macro_derive(DeriveEntity, attributes(entity))]
|
||||
#[proc_macro_derive(DeriveEntity, attributes(table))]
|
||||
pub fn derive_entity(input: TokenStream) -> TokenStream {
|
||||
let DeriveInput { ident, attrs, .. } = parse_macro_input!(input);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::entity::prelude::*;
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
|
||||
#[entity = "cake"]
|
||||
#[table = "cake"]
|
||||
pub struct Entity;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, DeriveModel)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::entity::prelude::*;
|
||||
|
||||
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
|
||||
#[entity = "fruit"]
|
||||
#[table = "fruit"]
|
||||
pub struct Entity;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, DeriveModel)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user