/
germanubis
/
sqlx
ΠΠ±Π·ΠΎΡ
ΠΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ
ΠΠΎΠΉΡΠΈ
/
germanubis
/
sqlx
ΠΠΎΠ΄
ΠΠ°ΠΏΡΠΎΡΡ
0
ΠΠ°Π΄Π°ΡΠΈ
ΠΠΈΠΊΠΈ
ΠΠ°ΠΊΠ΅ΡΡ
0
Π Π΅Π»ΠΈΠ·Ρ
0
ΠΠ½Π°Π»ΠΈΡΠΈΠΊΠ°
ΠΠ΅Π·ΠΎΠΏΠ°ΡΠ½ΠΎΡΡΡ
v0.8.6
sqlx-postgres/src/column.rs
54 ΡΡΡΠΎΠΊΠΈ
2 KB
Kurt Wolf
feat: expose relation_id and relation_attribution_no on PgColumn (#3492)
08 ΡΠ΅Π½ 2024, 04:43
ΠΠ΅ Π²Π΅ΡΠΈΡΠΈΡΠΈΡΠΎΠ²Π°Π½
08 ΡΠ΅Π½ 2024, 04:43
c597a22
ΠΠΎΠ΄
ΠΠ²ΡΠΎΡΡΡΠ²ΠΎ
Π ΡΡΠΌ ΠΊΠΎΠ΄?
use crate::ext::ustr::UStr; use crate::{PgTypeInfo, Postgres}; pub(crate) use sqlx_core::column::{Column, ColumnIndex}; #[derive(Debug, Clone)] #[cfg_attr(feature = "offline", derive(serde::Serialize, serde::Deserialize))] pub struct PgColumn { pub(crate) ordinal: usize, pub(crate) name: UStr, pub(crate) type_info: PgTypeInfo, #[cfg_attr(feature = "offline", serde(skip))] pub(crate) relation_id: Option<crate::types::Oid>, #[cfg_attr(feature = "offline", serde(skip))] pub(crate) relation_attribute_no: Option<i16>, } impl PgColumn { /// Returns the OID of the table this column is from, if applicable. /// /// This will be `None` if the column is the result of an expression. /// /// Corresponds to column `attrelid` of the `pg_catalog.pg_attribute` table: /// <https://www.postgresql.org/docs/current/catalog-pg-attribute.html> pub fn relation_id(&self) -> Option<crate::types::Oid> { self.relation_id } /// Returns the 1-based index of this column in its parent table, if applicable. /// /// This will be `None` if the column is the result of an expression. /// /// Corresponds to column `attnum` of the `pg_catalog.pg_attribute` table: /// <https://www.postgresql.org/docs/current/catalog-pg-attribute.html> pub fn relation_attribute_no(&self) -> Option<i16> { self.relation_attribute_no } } impl Column for PgColumn { type Database = Postgres; fn ordinal(&self) -> usize { self.ordinal } fn name(&self) -> &str { &self.name } fn type_info(&self) -> &PgTypeInfo { &self.type_info } }