You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
497 B
Rust
23 lines
497 B
Rust
3 years ago
|
use sea_orm::prelude::*;
|
||
|
|
||
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||
|
#[sea_orm(table_name = "namespaces")]
|
||
|
pub struct Model {
|
||
|
#[sea_orm(primary_key)]
|
||
|
pub id: u64,
|
||
|
pub name: String
|
||
|
}
|
||
|
|
||
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||
|
pub enum Relation {
|
||
|
#[sea_orm(has_many = "super::tag::Entity")]
|
||
|
Tag,
|
||
|
}
|
||
|
|
||
|
impl Related<super::tag::Entity> for Entity {
|
||
|
fn to() -> RelationDef {
|
||
|
Relation::Tag.def()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl ActiveModelBehavior for ActiveModel {}
|