Skip to main content

SqlEntity

Trait SqlEntity 

Source
pub trait SqlEntity: Structured + Sized {
    // Required methods
    fn get_projection() -> Projection<Self>;
    fn hydrate(row: &Row) -> Result<Self, HydrationError>;
}
Expand description

A trait to mark types that are SQL entities. An SQL entity is a type that has a structure, a projection and a hydration function.

Required Methods§

Source

fn get_projection() -> Projection<Self>

Get the projection of the entity.

Source

fn hydrate(row: &Row) -> Result<Self, HydrationError>

Hydrate the entity from a row.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§