* sea-orm-cli Implement derives & attributes parameters for entity generation (#1124) * implement derives & attributes for cli * fmt and clippy fix * use comma delimiter for attributes arg * Update help message use `'` instead of `"` to quote * Refactoring * remove unnecessary cloning Co-authored-by: Billy Chan <ccw.billy.123@gmail.com> * [CLI] generate model with extra derives and attributes * clippy Co-authored-by: Isaiah Gamble <77396670+tsar-boomba@users.noreply.github.com>
36 lines
873 B
Rust
36 lines
873 B
Rust
//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0
|
|
|
|
use sea_orm::entity::prelude:: * ;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
|
#[sea_orm(table_name = "cake")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
#[sea_orm(column_type = "Text", nullable)]
|
|
pub name: Option<String> ,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::fruit::Entity")]
|
|
Fruit,
|
|
}
|
|
|
|
impl Related<super::fruit::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Fruit.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::filling::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
super::cake_filling::Relation::Filling.def()
|
|
}
|
|
fn via() -> Option<RelationDef> {
|
|
Some(super::cake_filling::Relation::Cake.def().rev())
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|