athena_rs 3.26.2

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::schema_backend::require_schema_backend;

/// 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 backend = match require_schema_backend(&req, app_state.get_ref()).await {
        Ok(backend) => backend,
        Err(resp) => return resp,
    };

    schema_tables_response(&backend, app_state.get_ref()).await
}