use sea_orm::entity::prelude::*; | |
use serde::{Deserialize, Serialize}; | |
pub struct Model { | |
pub id: i64, | |
pub kb_id: i64, | |
pub did: i64, | |
} | |
pub enum Relation { | |
DocInfo, | |
KbInfo, | |
} | |
impl RelationTrait for Relation { | |
fn def(&self) -> RelationDef { | |
match self { | |
Self::DocInfo => Entity::belongs_to(super::doc_info::Entity) | |
.from(Column::Did) | |
.to(super::doc_info::Column::Did) | |
.into(), | |
Self::KbInfo => Entity::belongs_to(super::kb_info::Entity) | |
.from(Column::KbId) | |
.to(super::kb_info::Column::KbId) | |
.into(), | |
} | |
} | |
} | |
impl ActiveModelBehavior for ActiveModel {} |