floz-orm 0.1.7

A lightweight, typesafe Rust ORM — unifying DAO and DSL from a single schema
Documentation
//! Query builders — SELECT, INSERT, UPDATE, DELETE.
//!
//! Each builder accumulates clauses via method chaining,
//! then renders to a SQL string + parameter vector via `to_sql()`.
//!
//! All builders are tested purely via string assertions — no database required.

pub mod select;
pub mod insert;
pub mod update;
pub mod delete;

/// Quote a table name for SQL. If the name contains a dot (schema-qualified),
/// split and quote each part: `auth.users` → `"auth"."users"`.
/// Simple names are used as-is: `users` → `users`.
pub(crate) fn quote_table(name: &str) -> String {
    if name.contains('.') {
        name.split('.')
            .map(|part| format!("\"{}\"", part))
            .collect::<Vec<_>>()
            .join(".")
    } else {
        name.to_string()
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn quote_simple_table() {
        assert_eq!(quote_table("users"), "users");
    }

    #[test]
    fn quote_schema_qualified() {
        assert_eq!(quote_table("auth.users"), "\"auth\".\"users\"");
    }

    #[test]
    fn quote_triple_qualified() {
        assert_eq!(quote_table("catalog.schema.table"), "\"catalog\".\"schema\".\"table\"");
    }
}