use crate::PgType;
use std::collections::BTreeMap;
#[derive(Debug, Default, Clone)]
pub struct PgTableDesc {
pub data: BTreeMap<String, Vec<PgTableItem>>,
}
impl PgTableDesc {
pub fn get_data(&self, key: String, case_sensitive: bool) -> Option<&Vec<PgTableItem>> {
let key = if case_sensitive {
key
} else {
key.to_uppercase()
};
self.data.get(&key)
}
}
#[derive(Debug, Clone)]
pub struct PgTableItem {
pub name: String,
pub table_id: usize,
pub col_index: usize,
pub r#type: PgType,
pub length: usize,
pub scale: usize,
pub nullable: bool,
pub default_val: Option<String>,
pub table_name: String,
pub create_time: String,
}