polypixel-memoir-core 0.4.0

Memoir memory substrate as an embeddable Rust library
Documentation
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0

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

#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "memory_jobs")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i64,
    #[sea_orm(column_type = "Text")]
    pub source_pid: String,
    #[sea_orm(column_type = "Text")]
    pub kind: String,
    #[sea_orm(column_type = "Text")]
    pub state: String,
    #[sea_orm(column_type = "JsonBinary")]
    pub payload: Json,
    pub attempts: i32,
    #[sea_orm(column_type = "Text", nullable)]
    pub failure_reason: Option<String>,
    pub claimed_at: Option<DateTimeWithTimeZone>,
    #[sea_orm(column_type = "Text", nullable)]
    pub claimed_by: Option<String>,
    pub created_at: DateTimeWithTimeZone,
    pub updated_at: DateTimeWithTimeZone,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::memories::Entity",
        from = "Column::SourcePid",
        to = "super::memories::Column::Pid",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    Memories,
}

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

impl ActiveModelBehavior for ActiveModel {}