uqa_sql/catalog/dependencies/
address.rs1use std::cmp::Ordering;
10
11pub const RELATION_CLASS: u32 = 1259;
13pub const TYPE_CLASS: u32 = 1247;
15pub const PROCEDURE_CLASS: u32 = 1255;
17pub const CONSTRAINT_CLASS: u32 = 2606;
19pub const ATTRIBUTE_DEFAULT_CLASS: u32 = 2604;
21pub const REWRITE_CLASS: u32 = 2618;
23pub const TRIGGER_CLASS: u32 = 2620;
25pub const NAMESPACE_CLASS: u32 = 2615;
27pub const COLLATION_CLASS: u32 = 3456;
29pub const LANGUAGE_CLASS: u32 = 2612;
31pub const ROLE_CLASS: u32 = 1260;
33pub const ROLE_MEMBERSHIP_CLASS: u32 = 1261;
35pub const FOREIGN_WRAPPER_CLASS: u32 = 2328;
37
38pub const FOREIGN_SERVER_CLASS: u32 = 1417;
40pub const DATABASE_CLASS: u32 = 1262;
42
43#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct ObjectAddress {
46 pub class_id: u32,
47 pub object_id: u32,
48 pub sub_id: i32,
49}
50
51impl ObjectAddress {
52 #[must_use]
53 pub const fn whole(class_id: u32, object_id: u32) -> Self {
54 Self {
55 class_id,
56 object_id,
57 sub_id: 0,
58 }
59 }
60
61 #[must_use]
63 pub const fn column(relation: u32, column_number: i32) -> Self {
64 Self {
65 class_id: RELATION_CLASS,
66 object_id: relation,
67 sub_id: column_number,
68 }
69 }
70
71 #[must_use]
73 pub const fn whole_object(self) -> Self {
74 Self::whole(self.class_id, self.object_id)
75 }
76
77 pub(super) const fn same_object(self, other: Self) -> bool {
78 self.class_id == other.class_id && self.object_id == other.object_id
79 }
80
81 pub(super) fn deletion_order(&self, other: &Self) -> Ordering {
83 other
84 .object_id
85 .cmp(&self.object_id)
86 .then(self.class_id.cmp(&other.class_id))
87 .then(
88 self.sub_id
89 .cast_unsigned()
90 .cmp(&other.sub_id.cast_unsigned()),
91 )
92 }
93}