teaql_core/naming.rs
1pub fn default_table_name(entity_name: &str) -> String {
2 let mut out = String::with_capacity(entity_name.len() + 5);
3 for (index, ch) in entity_name.chars().enumerate() {
4 match ch.is_ascii_uppercase() {
5 true => {
6 if index > 0 {
7 out.push('_');
8 }
9 out.push(ch.to_ascii_lowercase());
10 }
11 false => out.push(ch),
12 }
13 }
14 out.push_str("_data");
15 out
16}