25 lines
610 B
Rust
25 lines
610 B
Rust
use sea_orm::entity::prelude::*;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
|
#[sea_orm(table_name = "active_enum")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
pub category: Category,
|
|
pub category_opt: Option<Category>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|
|
|
|
#[derive(Debug, Clone, PartialEq, DeriveActiveEnum)]
|
|
#[sea_orm(rs_type = "String", db_type = "String(Some(1))")]
|
|
pub enum Category {
|
|
#[sea_orm(string_value = "B")]
|
|
Big,
|
|
#[sea_orm(string_value = "S")]
|
|
Small,
|
|
}
|