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.
30 lines
641 B
Rust
30 lines
641 B
Rust
use sea_orm::prelude::*;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
|
#[sea_orm(table_name = "namespaces")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub job_id: i64,
|
|
#[sea_orm(primary_key)]
|
|
pub key: String,
|
|
pub value: Vec<u8>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::job::Entity",
|
|
from = "Column::JobId",
|
|
to = "super::job::Column::Id"
|
|
)]
|
|
Job,
|
|
}
|
|
|
|
impl Related<super::job::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Job.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|