File tree Expand file tree Collapse file tree 4 files changed +58
-6
lines changed Expand file tree Collapse file tree 4 files changed +58
-6
lines changed Original file line number Diff line number Diff line change 18
18
19
19
use super :: tables:: table:: Table ;
20
20
21
- struct Database {
21
+ pub struct Database {
22
+ name : String ,
22
23
tables : Vec < Table > ,
23
24
}
24
25
25
26
impl Database {
26
- pub fn new ( tables : Vec < Table > ) -> Self {
27
+ pub fn create_database ( name : String , tables : Vec < Table > ) -> Self {
27
28
Self {
28
- tables
29
+ name,
30
+ tables,
29
31
}
30
32
}
33
+
34
+ pub fn create_database_without_tables ( name : String ) -> Self {
35
+ Self {
36
+ name,
37
+ tables : Vec :: new ( ) ,
38
+ }
39
+ }
40
+
41
+ pub fn delete_table ( & mut self , name : String ) {
42
+ todo ! ( )
43
+ }
31
44
}
Original file line number Diff line number Diff line change 17
17
*/
18
18
19
19
pub struct Row {
20
+ primary_key : u32 ,
20
21
columns : Vec < String > ,
21
22
}
22
23
23
24
impl Row {
24
- pub fn new ( id : u32 , columns : Vec < String > ) -> Self {
25
+ pub fn create_row ( primary_key : u32 , columns : Vec < String > ) -> Self {
25
26
Self {
27
+ primary_key,
26
28
columns,
27
29
}
28
30
}
31
+
32
+ pub fn create_row_without_columns ( primary_key : u32 ) -> Self {
33
+ Self {
34
+ primary_key,
35
+ columns : Vec :: new ( ) ,
36
+ }
37
+ }
38
+
39
+ pub fn create_column ( & mut self , primary_key : u32 , name : String ) {
40
+ todo ! ( )
41
+ }
42
+
43
+ pub fn delete_column ( & mut self , name : String ) {
44
+ todo ! ( )
45
+ }
29
46
}
Original file line number Diff line number Diff line change @@ -25,10 +25,21 @@ pub struct Table {
25
25
}
26
26
27
27
impl Table {
28
- pub fn new ( name : String , rows : HashMap < u32 , Row > ) -> Self {
28
+ pub fn create_table ( name : String , rows : HashMap < u32 , Row > ) -> Self {
29
29
Self {
30
30
name,
31
31
rows,
32
32
}
33
33
}
34
+
35
+ pub fn create_table_without_rows ( name : String ) -> Self {
36
+ Self {
37
+ name,
38
+ rows : HashMap :: new ( ) ,
39
+ }
40
+ }
41
+
42
+ pub fn delete_row ( & mut self , primary_key : u32 ) {
43
+ todo ! ( )
44
+ }
34
45
}
Original file line number Diff line number Diff line change 16
16
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
*/
18
18
19
- pub ( crate ) mod databases;
19
+ pub ( crate ) mod databases;
20
+ use crate :: databases:: database:: Database ;
21
+
22
+ struct RNSQL {
23
+ databases : Vec < Database > ,
24
+ }
25
+
26
+ impl RNSQL {
27
+ pub fn new ( ) {
28
+ todo ! ( )
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments