athena_rs 3.18.0

Hyper performant polyglot Database driver
Documentation
//! Expected logging-schema contract types used by `/debug/schema`.
//!
//! This module defines the data model for one expected logging-client relation
//! and helper methods reused across debug evaluation/report builders.

/// Internal specification for one expected logging-client relation.
#[derive(Debug, Clone, Copy)]
pub(super) struct ExpectedLoggingTable {
    /// Schema name expected for the relation.
    pub(super) table_schema: &'static str,
    /// Relation name expected by runtime paths.
    pub(super) table_name: &'static str,
    /// Expected relation type (`BASE TABLE` / `VIEW`).
    pub(super) relation_type: &'static str,
    /// Whether the table is required for healthy runtime behavior.
    pub(super) required: bool,
    /// Short purpose description shown in diagnostics payloads.
    pub(super) purpose: &'static str,
    /// Columns expected by runtime writes/reads for this relation.
    pub(super) required_columns: &'static [&'static str],
}

/// Helper methods for expected-table contract rows.
impl ExpectedLoggingTable {
    /// Returns a stable `schema.table` key for this table spec.
    pub(super) fn key(&self) -> String {
        format!("{}.{}", self.table_schema.trim(), self.table_name.trim())
    }

    /// Returns expected columns as owned strings for API payload assembly.
    pub(super) fn expected_columns(&self) -> Vec<String> {
        self.required_columns
            .iter()
            .map(|column| (*column).to_string())
            .collect()
    }
}