mocra 0.3.0

A distributed, event-driven crawling and data collection framework
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.11

use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(schema_name = "base", table_name = "module")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    #[sea_orm(unique)]
    pub name: String,
    pub enabled: bool,
    #[sea_orm(column_type = "JsonBinary")]
    pub config: Json,
    pub priority: i32,
    pub created_at: DateTime,
    pub updated_at: DateTime,
    pub version: i32,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(has_many = "super::rel_module_account::Entity")]
    RelModuleAccount,
    #[sea_orm(has_many = "super::rel_module_data_middleware::Entity")]
    RelModuleDataMiddleware,
    #[sea_orm(has_many = "super::rel_module_download_middleware::Entity")]
    RelModuleDownloadMiddleware,
    #[sea_orm(has_many = "super::rel_module_platform::Entity")]
    RelModulePlatform,
}

impl Related<super::rel_module_account::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::RelModuleAccount.def()
    }
}

impl Related<super::rel_module_data_middleware::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::RelModuleDataMiddleware.def()
    }
}

impl Related<super::rel_module_download_middleware::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::RelModuleDownloadMiddleware.def()
    }
}

impl Related<super::rel_module_platform::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::RelModulePlatform.def()
    }
}

impl Related<super::account::Entity> for Entity {
    fn to() -> RelationDef {
        super::rel_module_account::Relation::Account.def()
    }
    fn via() -> Option<RelationDef> {
        Some(super::rel_module_account::Relation::Module.def().rev())
    }
}

impl Related<super::data_middleware::Entity> for Entity {
    fn to() -> RelationDef {
        super::rel_module_data_middleware::Relation::DataMiddleware.def()
    }
    fn via() -> Option<RelationDef> {
        Some(
            super::rel_module_data_middleware::Relation::Module
                .def()
                .rev(),
        )
    }
}

impl Related<super::download_middleware::Entity> for Entity {
    fn to() -> RelationDef {
        super::rel_module_download_middleware::Relation::DownloadMiddleware.def()
    }
    fn via() -> Option<RelationDef> {
        Some(
            super::rel_module_download_middleware::Relation::Module
                .def()
                .rev(),
        )
    }
}

impl Related<super::platform::Entity> for Entity {
    fn to() -> RelationDef {
        super::rel_module_platform::Relation::Platform.def()
    }
    fn via() -> Option<RelationDef> {
        Some(super::rel_module_platform::Relation::Module.def().rev())
    }
}

impl ActiveModelBehavior for ActiveModel {}