diff --git a/src/databases/database.rs b/src/databases/database.rs index 818e421..85bcfb4 100644 --- a/src/databases/database.rs +++ b/src/databases/database.rs @@ -18,14 +18,27 @@ use super::tables::table::Table; -struct Database { +pub struct Database { + name: String, tables: Vec, } impl Database { - pub fn new(tables: Vec
) -> Self { + pub fn create_database(name: String, tables: Vec
) -> Self { Self { - tables + name, + tables, } } + + pub fn create_database_without_tables(name: String) -> Self { + Self { + name, + tables: Vec::new(), + } + } + + pub fn delete_table(&mut self, name: String) { + todo!() + } } \ No newline at end of file diff --git a/src/databases/tables/rows/row.rs b/src/databases/tables/rows/row.rs index 667570d..41e81db 100644 --- a/src/databases/tables/rows/row.rs +++ b/src/databases/tables/rows/row.rs @@ -17,13 +17,30 @@ */ pub struct Row { + primary_key: u32, columns: Vec, } impl Row { - pub fn new(id: u32, columns: Vec) -> Self { + pub fn create_row(primary_key: u32, columns: Vec) -> Self { Self { + primary_key, columns, } } + + pub fn create_row_without_columns(primary_key: u32) -> Self { + Self { + primary_key, + columns: Vec::new(), + } + } + + pub fn create_column(&mut self, primary_key: u32, name: String) { + todo!() + } + + pub fn delete_column(&mut self, name: String) { + todo!() + } } \ No newline at end of file diff --git a/src/databases/tables/table.rs b/src/databases/tables/table.rs index 8d99f47..98638b8 100644 --- a/src/databases/tables/table.rs +++ b/src/databases/tables/table.rs @@ -25,10 +25,21 @@ pub struct Table { } impl Table { - pub fn new(name: String, rows: HashMap) -> Self { + pub fn create_table(name: String, rows: HashMap) -> Self { Self { name, rows, } } + + pub fn create_table_without_rows(name: String) -> Self { + Self { + name, + rows: HashMap::new(), + } + } + + pub fn delete_row(&mut self, primary_key: u32) { + todo!() + } } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index e11417d..55f9b48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,4 +16,15 @@ * along with this program. If not, see . */ -pub(crate) mod databases; \ No newline at end of file +pub(crate) mod databases; +use crate::databases::database::Database; + +struct RNSQL { + databases: Vec, +} + +impl RNSQL { + pub fn new() { + todo!() + } +} \ No newline at end of file