1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::{Table, View};

use serde::{Deserialize, Serialize};

/// Captures information about the database and its members
#[derive(Clone, derive_more::Constructor, Debug, Serialize, Deserialize)]
pub struct Schema {
  name: String,
  tables: Vec<Table>,
  views: Vec<View>,
  types: Vec<String>
}

impl Schema {
  pub fn name(&self) -> &String {
    &self.name
  }

  pub fn tables(&self) -> &Vec<Table> {
    &self.tables
  }

  pub fn views(&self) -> &Vec<View> {
    &self.views
  }

  pub fn types(&self) -> &Vec<String> {
    &self.types
  }
}