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 = "memories")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i64,
    #[sea_orm(column_type = "Text", unique)]
    pub pid: String,
    #[sea_orm(column_type = "Text")]
    pub agent_id: String,
    #[sea_orm(column_type = "Text")]
    pub org_id: String,
    #[sea_orm(column_type = "Text")]
    pub user_id: String,
    #[sea_orm(column_type = "Text")]
    pub content: String,
    #[sea_orm(column_type = "JsonBinary")]
    pub metadata: Json,
    #[sea_orm(column_type = "Text")]
    pub kind: String,
    #[sea_orm(column_type = "Text")]
    pub qdrant_status: String,
    pub created_at: DateTimeWithTimeZone,
    pub updated_at: DateTimeWithTimeZone,
    #[sea_orm(column_type = "Text", nullable)]
    pub source_pid: Option<String>,
    #[sea_orm(column_type = "Text", nullable)]
    pub superseded_by: Option<String>,
    pub event_at: Option<DateTimeWithTimeZone>,
    pub confidence: i16,
    #[sea_orm(column_type = "Text", nullable)]
    pub category: Option<String>,
    #[sea_orm(column_type = "Text", nullable)]
    pub retirement_reason: Option<String>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "Entity",
        from = "Column::SourcePid",
        to = "Column::Pid",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    SelfRef2,
    #[sea_orm(
        belongs_to = "Entity",
        from = "Column::SupersededBy",
        to = "Column::Pid",
        on_update = "NoAction",
        on_delete = "SetNull"
    )]
    SelfRef1,
    #[sea_orm(has_many = "super::memory_jobs::Entity")]
    MemoryJobs,
}

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

impl ActiveModelBehavior for ActiveModel {}