Skip to main content

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        if ch.is_ascii_uppercase() {
5            if index > 0 {
6                out.push('_');
7            }
8            out.push(ch.to_ascii_lowercase());
9        } else {
10            out.push(ch);
11        }
12    }
13    out.push_str("_data");
14    out
15}