athena_rs 3.26.2

Hyper performant polyglot Database driver
Documentation
//! Observed-table relation-key generation for `/debug/schema`.
//!
//! This module owns stable `schema.table` key generation for observed-table
//! maps and downstream deterministic sorting.

/// Builds a stable `schema.table` key.
pub(super) fn relation_key(schema: &str, table: &str) -> String {
    format!("{}.{}", schema.trim(), table.trim())
}

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

    /// Trims schema and table values before joining into a relation key.
    #[test]
    fn relation_key_trims_whitespace_in_schema_and_table() {
        assert_eq!(
            relation_key(" public ", " gateway_request_log "),
            "public.gateway_request_log".to_string()
        );
    }
}