athena_rs 3.18.0

Hyper performant polyglot Database driver
Documentation
//! `/schema/tables` catalog HTTP handler.
//!
//! This module owns pool resolution and response orchestration for the schema
//! tables endpoint.

use actix_web::{HttpRequest, Responder, get, web::Data};

use crate::AppState;

use super::super::catalog_responses::schema_tables_response;
use super::super::catalog_route_context::require_schema_pool;

/// Lists all tables and views visible to the supplied `X-Athena-Client`.
#[get("/schema/tables")]
pub(in super::super) async fn schema_tables(
    req: HttpRequest,
    app_state: Data<AppState>,
) -> impl Responder {
    let pool = match require_schema_pool(&req, app_state.get_ref()).await {
        Ok(pool) => pool,
        Err(resp) => return resp,
    };

    schema_tables_response(&pool).await
}