sea_orm

Derive Macro DeriveCustomColumn

Source
#[derive(DeriveCustomColumn)]
Expand description

Derive a column if column names are not in snake-case

ยงUsage

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

#[derive(Copy, Clone, Debug, EnumIter, DeriveCustomColumn)]
pub enum Column {
    Id,
    Name,
    VendorId,
}

impl IdenStatic for Column {
    fn as_str(&self) -> &str {
        match self {
            Self::Id => "id",
            _ => self.default_as_str(),
        }
    }
}