Chris Tsang 7af76fc753
Seaography example WIP (#1788)
* Seaography example WIP

* Seaography example

* Screenshot
2023-07-30 05:08:28 +08:00

44 lines
1014 B
Rust

//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "bakery")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
#[sea_orm(column_type = "Double")]
pub profit_margin: f64,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::baker::Entity")]
Baker,
#[sea_orm(has_many = "super::cake::Entity")]
Cake,
}
impl Related<super::baker::Entity> for Entity {
fn to() -> RelationDef {
Relation::Baker.def()
}
}
impl Related<super::cake::Entity> for Entity {
fn to() -> RelationDef {
Relation::Cake.def()
}
}
impl ActiveModelBehavior for ActiveModel {}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
#[sea_orm(entity = "super::baker::Entity")]
Baker,
#[sea_orm(entity = "super::cake::Entity")]
Cake,
}