#[derive(DbEnum)]
{
// Attributes available to this derive:
#[PgType]
#[DieselType]
#[ExistingTypePath]
#[DbValueStyle]
#[db_rename]
}
Expand description
Implement the traits necessary for inserting the enum directly into a database
§Attributes
§Type attributes
#[ExistingTypePath = "crate::schema::sql_types::NewEnum"]specifies the path to a corresponding diesel type that was already created by the diesel CLI. If omitted, the type will be generated by this macro. Note: Only applies topostgres, will error if specified for other databases#[DieselType = "NewEnumMapping"]specifies the name for the diesel type to create. If omitted, uses<enum name>Mapping. Note: Cannot be specified alongsideExistingTypePath#[DbValueStyle = "snake_case"]specifies a renaming style from each of the rust enum variants to each of the database variants. EithercamelCase,kebab-case,PascalCase,SCREAMING_SNAKE_CASE,snake_case,verbatim. If omitted, usessnake_case.
§Variant attributes
#[db_rename = "variant"]specifies the db name for a specific variant.