Skip to main content

hematite/catalog/
ids.rs

1//! ID types for database objects
2
3/// Unique identifier for database tables
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub struct TableId(u32);
6
7impl TableId {
8    pub fn new(id: u32) -> Self {
9        Self(id)
10    }
11
12    pub fn as_u32(&self) -> u32 {
13        self.0
14    }
15}
16
17/// Unique identifier for table columns
18#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
19pub struct ColumnId(u32);
20
21impl ColumnId {
22    pub fn new(id: u32) -> Self {
23        Self(id)
24    }
25
26    pub fn as_u32(&self) -> u32 {
27        self.0
28    }
29}