Skip to main content

feophantlib/constants/
system_tables.rs

1//! This defines all the system internal tables so we can bootstrap the system.
2
3use super::super::engine::objects::Table;
4use std::sync::Arc;
5
6pub mod pg_attribute;
7pub mod pg_class;
8pub mod pg_constraint;
9pub mod pg_index;
10
11#[derive(Copy, Clone)]
12pub enum SystemTables {
13    PgAttribute, //Columns
14    PgClass,     //Tables
15    PgConstraint,
16    PgIndex,
17}
18
19impl SystemTables {
20    //TODO Should this be removed?
21    pub const VALUES: [SystemTables; 4] = [
22        SystemTables::PgAttribute,
23        SystemTables::PgClass,
24        SystemTables::PgConstraint,
25        SystemTables::PgIndex,
26    ];
27    pub fn value(self) -> Arc<Table> {
28        match self {
29            SystemTables::PgClass => pg_class::get_table(),
30            SystemTables::PgAttribute => pg_attribute::get_table(),
31            SystemTables::PgConstraint => pg_constraint::get_table(),
32            SystemTables::PgIndex => pg_index::get_table(),
33        }
34    }
35}