mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-13 17:27:50 +00:00
Added support for kebab case for postgres enums
This commit is contained in:
parent
4bfd7a555f
commit
e56ce0a998
@ -32,6 +32,7 @@ pub enum RenameAll {
|
||||
SnakeCase,
|
||||
UpperCase,
|
||||
ScreamingSnakeCase,
|
||||
KebabCase,
|
||||
}
|
||||
|
||||
pub struct SqlxContainerAttributes {
|
||||
@ -75,6 +76,7 @@ pub fn parse_container_attributes(input: &[Attribute]) -> syn::Result<SqlxContai
|
||||
"snake_case" => RenameAll::SnakeCase,
|
||||
"UPPERCASE" => RenameAll::UpperCase,
|
||||
"SCREAMING_SNAKE_CASE" => RenameAll::ScreamingSnakeCase,
|
||||
"kebab-case" => RenameAll::KebabCase,
|
||||
|
||||
_ => fail!(meta, "unexpected value for rename_all"),
|
||||
};
|
||||
|
||||
@ -10,7 +10,7 @@ pub(crate) use r#type::expand_derive_type;
|
||||
pub(crate) use row::expand_derive_from_row;
|
||||
|
||||
use self::attributes::RenameAll;
|
||||
use heck::{ShoutySnakeCase, SnakeCase};
|
||||
use heck::{ShoutySnakeCase, SnakeCase, KebabCase};
|
||||
use std::iter::FromIterator;
|
||||
use syn::DeriveInput;
|
||||
|
||||
@ -34,5 +34,6 @@ pub(crate) fn rename_all(s: &str, pattern: RenameAll) -> String {
|
||||
RenameAll::SnakeCase => s.to_snake_case(),
|
||||
RenameAll::UpperCase => s.to_uppercase(),
|
||||
RenameAll::ScreamingSnakeCase => s.to_shouty_snake_case(),
|
||||
RenameAll::KebabCase => s.to_kebab_case(),
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user