sea_orm

Derive Macro DeriveRelation

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

The DeriveRelation derive macro will implement RelationTrait for Relation.

ยงUsage

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

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "sea_orm::tests_cfg::cake::Entity",
        from = "sea_orm::tests_cfg::fruit::Column::CakeId",
        to = "sea_orm::tests_cfg::cake::Column::Id"
    )]
    Cake,
    #[sea_orm(
        belongs_to = "sea_orm::tests_cfg::cake_expanded::Entity",
        from = "sea_orm::tests_cfg::fruit::Column::CakeId",
        to = "sea_orm::tests_cfg::cake_expanded::Column::Id"
    )]
    CakeExpanded,
}