athena_rs 3.26.2

Hyper performant polyglot Database driver
Documentation
//! `/schema/tables` response payload mapping helpers.
//!
//! This module maps relation records into table payload rows.

use super::super::response_contracts::SchemaTable;
use super::super::service::SchemaRelationRecord;

/// Maps relation rows into `/schema/tables` payload rows.
pub(in super::super) fn schema_tables(relations: Vec<SchemaRelationRecord>) -> Vec<SchemaTable> {
    relations
        .into_iter()
        .map(|relation| {
            let relation_type = relation.relation_type;
            let is_view = relation_type.eq_ignore_ascii_case("VIEW");
            SchemaTable {
                table_schema: relation.table_schema,
                table_name: relation.table_name,
                relation_type,
                is_view,
            }
        })
        .collect()
}