athena_rs 3.3.0

Database gateway API
Documentation
use actix_web::{HttpMessage, HttpRequest};

#[derive(Debug, Clone)]
pub struct ResolvedAthenaClient(pub String);

#[derive(Debug, Clone, Copy)]
pub struct DisallowJdbcRouting;

pub fn set_resolved_athena_client(req: &HttpRequest, client_name: String) {
    req.extensions_mut()
        .insert(ResolvedAthenaClient(client_name));
}

pub fn resolved_athena_client(req: &HttpRequest) -> Option<String> {
    req.extensions()
        .get::<ResolvedAthenaClient>()
        .map(|v| v.0.clone())
}

pub fn set_disallow_jdbc_routing(req: &HttpRequest) {
    req.extensions_mut().insert(DisallowJdbcRouting);
}

pub fn disallow_jdbc_routing(req: &HttpRequest) -> bool {
    req.extensions().get::<DisallowJdbcRouting>().is_some()
}