sea_orm::entity::prelude

Derive Macro DeriveRelatedEntity

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

The DeriveRelatedEntity derive macro will implement seaography::RelationBuilder for RelatedEntity enumeration.

ยงUsage

โ“˜
use sea_orm::entity::prelude::*;

// ...
// Model, Relation enum, etc.
// ...

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelatedEntity)]
pub enum RelatedEntity {
    #[sea_orm(entity = "super::address::Entity")]
    Address,
    #[sea_orm(entity = "super::payment::Entity")]
    Payment,
    #[sea_orm(entity = "super::rental::Entity")]
    Rental,
    #[sea_orm(entity = "Entity", def = "Relation::SelfRef.def()")]
    SelfRef,
    #[sea_orm(entity = "super::store::Entity")]
    Store,
    #[sea_orm(entity = "Entity", def = "Relation::SelfRef.def().rev()")]
    SelfRefRev,
}