sql_reverse 0.1.21

Generate the multiple programming languages structure based on the MySQL/PostgresSQL table structure
use crate::keywords::Keywords;
use fn_macro::hashmap;
use std::collections::HashMap;
use std::sync::LazyLock;

pub static RUST_KEYS: LazyLock<HashMap<&str, ()>> = LazyLock::new(|| {
    hashmap!(
        "if" => (),
        "else" => (),
        "loop" => (),
        "while" => (),
        "for" => (),
        "break" => (),
        "continue" => (),
        "return" => (),
        "match" => (),
        "fn" => (),
        "let" => (),
        "mut" => (),
        "const" => (),
        "static" => (),
        "struct" => (),
        "enum" => (),
        "union" =>(),
        "impl" => (),
        "trait" => (),
        "type" => (),
        "use" => (),
        "mod" => (),
        "pub" => (),
        "crate" => (),
        "self" => (),
        "Self" => (),
        "super" => (),
        "dyn" => (),
        "move" => (),
        "ref" => (),
        "async" => (),
        "await" => (),
        "unsafe" => (),
        "as" => (),
    )
});

pub struct Rust;

impl Keywords for Rust {
    fn check_field_name(&self, field_name: &str) -> String {
        if RUST_KEYS.contains_key(field_name) {
            format!("r#{}", field_name)
        } else {
            field_name.to_string()
        }
    }
}