File size: 1,055 Bytes
c6d0d85 6858ec5 c6d0d85 f102c60 c6d0d85 249b27c f102c60 c6d0d85 249b27c c6d0d85 6858ec5 c6d0d85 6858ec5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
use sea_orm::entity::prelude::*;
use serde::{ Deserialize, Serialize };
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)]
#[sea_orm(table_name = "dialog2_kb")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = true)]
pub id: i64,
#[sea_orm(index)]
pub dialog_id: i64,
#[sea_orm(index)]
pub kb_id: i64,
}
#[derive(Debug, Clone, Copy, EnumIter)]
pub enum Relation {
DialogInfo,
KbInfo,
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DialogInfo =>
Entity::belongs_to(super::dialog_info::Entity)
.from(Column::DialogId)
.to(super::dialog_info::Column::DialogId)
.into(),
Self::KbInfo =>
Entity::belongs_to(super::kb_info::Entity)
.from(Column::KbId)
.to(super::kb_info::Column::KbId)
.into(),
}
}
}
impl ActiveModelBehavior for ActiveModel {}
|