Skip to main content

BaseEntity

Trait BaseEntity 

Source
pub trait BaseEntity: Send + Sync {
    type LoaderType;

    // Required methods
    fn load() -> Self::LoaderType;
    fn id(&self) -> i64;
    fn uid(&self) -> Uuid;
    fn created_at(&self) -> DateTimeWithTimeZone;
    fn updated_at(&self) -> DateTimeWithTimeZone;
}
Expand description

Uniform identity view over a model.

Implement for each SeaORM entity model so generic query and repository code can read id, uid, and timestamps without knowing the concrete type.

Required Associated Types§

Source

type LoaderType

The loader type used to load relations for this entity.

Required Methods§

Source

fn load() -> Self::LoaderType

Returns a loader for this entity type.

Source

fn id(&self) -> i64

Returns the primary key value.

Source

fn uid(&self) -> Uuid

Returns the stable public identifier.

Source

fn created_at(&self) -> DateTimeWithTimeZone

Returns the creation timestamp.

Source

fn updated_at(&self) -> DateTimeWithTimeZone

Returns the last-update timestamp.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§