mongo_crud_derive 0.1.0

A simple library to extract the mongoDB fetching process. Only for basic types.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub fn add_underscore(input_str: &String) -> String {
    input_str
        .chars()
        .enumerate()
        .map(|(i, c)| {
            if i == 0 {
                c.to_lowercase().to_string()
            } else if c.is_uppercase() {
                format!("_{}", c.to_lowercase())
            } else {
                c.to_lowercase().to_string()
            }
        })
        .collect()
}