1mod databasetree;
2mod databasetreeitems;
3mod error;
4mod item;
5mod tree_iter;
6mod treeitems_iter;
7
8pub use crate::{
9 databasetree::DatabaseTree,
10 databasetree::MoveSelection,
11 item::{DatabaseTreeItem, TreeItemInfo},
12};
13
14#[derive(Clone, PartialEq, Debug)]
15pub struct Database {
16 pub name: String,
17 pub children: Vec<Child>,
18}
19
20#[derive(Clone, PartialEq, Debug)]
21pub enum Child {
22 Table(Table),
23 Schema(Schema),
24}
25
26impl From<Table> for Child {
27 fn from(t: Table) -> Self {
28 Child::Table(t)
29 }
30}
31
32impl From<Schema> for Child {
33 fn from(s: Schema) -> Self {
34 Child::Schema(s)
35 }
36}
37
38impl Database {
39 pub fn new(database: String, children: Vec<Child>) -> Self {
40 Self {
41 name: database,
42 children,
43 }
44 }
45}
46
47#[derive(Clone, PartialEq, Debug)]
48pub struct Schema {
49 pub name: String,
50 pub tables: Vec<Table>,
51}
52
53#[derive(Debug, Clone, PartialEq)]
54pub struct Table {
55 pub name: String,
56 pub create_time: Option<chrono::DateTime<chrono::Utc>>,
57 pub update_time: Option<chrono::DateTime<chrono::Utc>>,
58 pub engine: Option<String>,
59 pub schema: Option<String>,
60}