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
31
32
33
34
35
36
37
38
use crate::{Table, View};

use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
pub struct Schema {
  name: String,
  tables: Vec<Table>,
  views: Vec<View>,
  types: Vec<String>
}

impl Schema {
  pub fn new(name: String, tables: Vec<Table>, views: Vec<View>, types: Vec<String>) -> Schema {
    Schema {
      name,
      tables,
      views,
      types
    }
  }

  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
  }
}