athena_rs 3.18.0

Hyper performant polyglot Database driver
Documentation
//! Relation-row snapshot query helpers for `/debug/schema`.
//!
//! This module owns relation fetch execution for logging-schema diagnostics
//! snapshot assembly while delegating SQL-error mapping to
//! `debug_snapshot_query_error_mapper`.

use sqlx::postgres::PgPool;

use super::debug_snapshot_error::LoggingSchemaSnapshotError;
use super::debug_snapshot_query_error_mapper::map_snapshot_relations_fetch_error;
use super::service::{SchemaRelationRecord, fetch_relations};

/// Fetches non-system relation rows for logging schema diagnostics.
pub(super) async fn fetch_logging_schema_snapshot_relations(
    pool: &PgPool,
) -> Result<Vec<SchemaRelationRecord>, LoggingSchemaSnapshotError> {
    fetch_relations(pool, None, true)
        .await
        .map_err(map_snapshot_relations_fetch_error)
}