pgrx_pg_sys/submodules/
tupdesc.rs

1//LICENSE Portions Copyright 2019-2021 ZomboDB, LLC.
2//LICENSE
3//LICENSE Portions Copyright 2021-2023 Technology Concepts & Design, Inc.
4//LICENSE
5//LICENSE Portions Copyright 2023-2023 PgCentral Foundation, Inc. <contact@pgcentral.org>
6//LICENSE
7//LICENSE All rights reserved.
8//LICENSE
9//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10//! Provides helper implementations for various `TupleDesc`-related structs
11
12use crate::oids::PgOid;
13use crate::utils::name_data_to_str;
14
15/// Helper implementation for `FormData_pg_attribute`
16impl crate::FormData_pg_attribute {
17    pub fn name(&self) -> &str {
18        name_data_to_str(&self.attname)
19    }
20
21    pub fn type_oid(&self) -> PgOid {
22        PgOid::from(self.atttypid)
23    }
24
25    pub fn type_mod(&self) -> i32 {
26        self.atttypmod
27    }
28
29    pub fn num(&self) -> i16 {
30        self.attnum
31    }
32
33    pub fn is_dropped(&self) -> bool {
34        self.attisdropped
35    }
36
37    pub fn rel_id(&self) -> crate::Oid {
38        self.attrelid
39    }
40}