asynq 0.1.8

Simple, reliable & efficient distributed task queue in Rust, inspired by hibiken/asynq
Documentation
//! 调度器实体
//! Scheduler entity

use sea_orm::entity::prelude::*;

/// 调度器实体模型
/// Scheduler entity model
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "asynq_schedulers")]
pub struct Model {
  #[sea_orm(primary_key, auto_increment = false)]
  pub id: String,
  pub host: String,
  pub pid: i32,
  pub status: String,
  pub started_at: DateTimeWithTimeZone,
  pub expires_at: DateTimeWithTimeZone,
  #[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
  pub scheduler_info: Option<Vec<u8>>,
  /// 租户 ID,用于多租户隔离
  /// Tenant ID for multi-tenancy isolation
  pub tenant_id: Option<String>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
  #[sea_orm(has_many = "super::scheduler_entries::Entity")]
  SchedulerEntries,
}

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

impl ActiveModelBehavior for ActiveModel {}