sea_orm_macros

Derive Macro DerivePrimaryKey

Source
#[derive(DerivePrimaryKey)]
{
    // Attributes available to this derive:
    #[sea_orm]
}
Expand description

The DerivePrimaryKey derive macro will implement [PrimaryKeyToColumn] for PrimaryKey which defines tedious mappings between primary keys and columns. The [EnumIter] is also derived, allowing iteration over all enum variants.

ยงUsage

use sea_orm::entity::prelude::*;

#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
    CakeId,
    FillingId,
}