shared-framework 0.0.17

Reusable building blocks for HTTP services — Hyper routing, SeaORM data layer, validation, OpenAPI docs, jobs, queues, cache.
Documentation
//! Seeder tracking entity.
//!
//! Maps the `__database_seeders` table recording which seeders have run.
//! Each row stores one executed seeder name with identity and timestamps;
//! implements [`BaseEntity`] so it works with generic repository code.
use crate::data::BaseEntity;
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

/// One executed seeder record in `__database_seeders`.
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "__database_seeders", rename_all = "camelCase")]
pub struct Model {
    /// Primary key value.
    #[sea_orm(primary_key)]
    pub id: i64,
    /// Stable public identifier.
    #[sea_orm(unique)]
    pub uid: Uuid,
    /// Unique seeder name as reported by the seeder.
    pub seeder_name: String,
    /// Creation timestamp.
    pub created_at: DateTimeWithTimeZone,
    /// Last-update timestamp.
    pub updated_at: DateTimeWithTimeZone,
}

impl ActiveModelBehavior for ActiveModel {}

impl BaseEntity for ModelEx {
    type LoaderType = EntityLoader;

    fn load() -> Self::LoaderType {
        Entity::load()
    }

    fn id(&self) -> i64 {
        self.id
    }
    fn uid(&self) -> Uuid {
        self.uid
    }
    fn created_at(&self) -> DateTimeWithTimeZone {
        self.created_at
    }
    fn updated_at(&self) -> DateTimeWithTimeZone {
        self.updated_at
    }
}