#[derive(SqlEnum)]
{
// Attributes available to this derive:
#[sqlmodel]
}
Expand description
Derive macro for SQL enum types.
Generates SqlEnum trait implementation, From<EnumType> for Value,
TryFrom<Value> for EnumType, and Display/FromStr implementations.
Enum variants are mapped to their snake_case string representations by default.
Use #[sqlmodel(rename = "custom_name")] on variants to override.
§Example
ⓘ
#[derive(SqlEnum, Debug, Clone, PartialEq)]
enum Status {
Active,
Inactive,
#[sqlmodel(rename = "on_hold")]
OnHold,
}