cdbc_pg/
column.rs

1use cdbc::column::Column;
2use cdbc::utils::ustr::UStr;
3use crate::{PgTypeInfo, Postgres};
4
5#[derive(Debug, Clone)]
6#[derive(serde::Serialize, serde::Deserialize)]
7pub struct PgColumn {
8    pub(crate) ordinal: usize,
9    pub(crate) name: UStr,
10    pub(crate) type_info: PgTypeInfo,
11    #[serde(skip)]
12    pub(crate) relation_id: Option<i32>,
13    #[serde(skip)]
14    pub(crate) relation_attribute_no: Option<i16>,
15}
16
17impl Column for PgColumn {
18    type Database = Postgres;
19
20    fn ordinal(&self) -> usize {
21        self.ordinal
22    }
23
24    fn name(&self) -> &str {
25        &*self.name
26    }
27
28    fn type_info(&self) -> &PgTypeInfo {
29        &self.type_info
30    }
31}