pgx_pg_sys/submodules/
tupdesc.rs

1/*
2Portions Copyright 2019-2021 ZomboDB, LLC.
3Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <support@tcdi.com>
4
5All rights reserved.
6
7Use of this source code is governed by the MIT license that can be found in the LICENSE file.
8*/
9
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}