Skip to main content

EntityMeta

Trait EntityMeta 

Source
pub trait EntityMeta:
    Send
    + Sync
    + 'static {
    type Id: Send + Sync + Clone + 'static;

    // Required methods
    fn table_name() -> &'static str;
    fn id_value(&self) -> &Self::Id;

    // Provided method
    fn id_column() -> &'static str { ... }
}
Expand description

EntityMeta Trait

Metadata trait for database entities. Provides information about the table and ID column.

§Type Parameters

  • Self: The entity type implementing the trait
  • Id: The type of the entity’s primary key

§Implementation

Typically implemented via the #[entity] macro.

Required Associated Types§

Source

type Id: Send + Sync + Clone + 'static

The type of the primary key

Required Methods§

Source

fn table_name() -> &'static str

Returns the database table name for this entity.

Source

fn id_value(&self) -> &Self::Id

Returns a reference to the entity’s ID value.

Provided Methods§

Source

fn id_column() -> &'static str

Returns the column name for the primary key. Defaults to “id”.

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§