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 1818
1919use super :: tables:: table:: Table ;
2020
21- struct Database {
21+ pub struct Database {
22+ name : String ,
2223 tables : Vec < Table > ,
2324}
2425
2526impl Database {
26- pub fn new ( tables : Vec < Table > ) -> Self {
27+ pub fn create_database ( name : String , tables : Vec < Table > ) -> Self {
2728 Self {
28- tables
29+ name,
30+ tables,
2931 }
3032 }
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+ }
3144}
Original file line number Diff line number Diff line change 1717 */
1818
1919pub struct Row {
20+ primary_key : u32 ,
2021 columns : Vec < String > ,
2122}
2223
2324impl Row {
24- pub fn new ( id : u32 , columns : Vec < String > ) -> Self {
25+ pub fn create_row ( primary_key : u32 , columns : Vec < String > ) -> Self {
2526 Self {
27+ primary_key,
2628 columns,
2729 }
2830 }
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+ }
2946}
Original file line number Diff line number Diff line change @@ -25,10 +25,21 @@ pub struct Table {
2525}
2626
2727impl Table {
28- pub fn new ( name : String , rows : HashMap < u32 , Row > ) -> Self {
28+ pub fn create_table ( name : String , rows : HashMap < u32 , Row > ) -> Self {
2929 Self {
3030 name,
3131 rows,
3232 }
3333 }
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+ }
3445}
Original file line number Diff line number Diff line change 1616 * along with this program. If not, see <https://www.gnu.org/licenses/>.
1717 */
1818
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