31 lines
748 B
Rust
31 lines
748 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 = "child")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
pub parent_id1: i32,
|
|
pub parent_id2: i32,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::parent::Entity",
|
|
from = "(Column::ParentId1, Column::ParentId2)",
|
|
to = "(super::parent::Column::Id1, super::parent::Column::Id2)",
|
|
)]
|
|
Parent,
|
|
}
|
|
|
|
impl Related<super::parent::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Parent.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|