athena_rs 3.26.3

Hyper performant polyglot Database driver
//! Present-table mutation policy for expected-table evaluation.
//!
//! This module owns how `/debug/schema` evaluation counters and payload rows are
//! updated when an expected table is discovered in observed schema state.

use super::debug_evaluation_contracts::ExpectedTablesEvaluation;
use super::debug_evaluation_present_counters::apply_present_comparison_counters;
use super::debug_evaluation_status_builder::build_present_expected_table_status;
use super::debug_observed_tables::LoggingSchemaObservedTable;
use super::debug_table_comparison::compare_observed_expected_table;
use super::logging_expectation_contracts::ExpectedLoggingTable;

/// Applies a found-table evaluation row into counters and payload output.
pub(super) fn push_present(
    evaluation: &mut ExpectedTablesEvaluation,
    expected: &ExpectedLoggingTable,
    observed: &LoggingSchemaObservedTable,
    expected_columns: Vec<String>,
) {
    let comparison =
        compare_observed_expected_table(observed, expected.relation_type, &expected_columns);

    apply_present_comparison_counters(evaluation, expected.required, &comparison);

    evaluation
        .expected_tables
        .push(build_present_expected_table_status(
            expected,
            expected_columns,
            observed,
            comparison,
        ));
}