Skip to content

Commit ae3ba1b

Browse files
authored
Merge pull request #1 from git-user-cpp/AndyKushyk-implemented-TableHolder-logic
All the files were re-written due to Rust code style
2 parents 6d4cda7 + 576d866 commit ae3ba1b

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

2525
pub mod main_module;
26-
use crate::main_module::data::DataObject::DataObject;
26+
use crate::main_module::data::data_object::DataObject;
2727

2828
fn main() {
2929
let new_obj = DataObject::new("name", "Oleg");

src/main_module/controller/CreateTableHandler.rs renamed to src/main_module/controller/create_table_handler.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222
* SOFTWARE.
2323
*/
2424

25-
use crate::main_module::data::DataHandler::DataHandler;
25+
use crate::main_module::data::data_handler::DataHandler;
2626

2727
pub struct CreateTableHandler {
28-
dataHandler: DataHandler,
28+
data_handler: DataHandler,
2929
}
3030

3131
impl CreateTableHandler {
3232
pub fn new() -> Self {
33-
let dataHandler = DataHandler::new();
33+
let data_handler = DataHandler::new();
3434

3535
CreateTableHandler {
36-
dataHandler,
36+
data_handler,
3737
}
3838
}
3939
}

src/main_module/controller/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
* SOFTWARE.
2323
*/
2424

25-
pub mod CreateTableHandler;
25+
pub mod create_table_handler;

src/main_module/data/DataHandler.rs renamed to src/main_module/data/data_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

2525
use std::collections::HashMap;
26-
use crate::main_module::data::Table::Table;
26+
use crate::main_module::data::table::Table;
2727

2828
pub struct DataHandler {
2929
tables: HashMap<String, Table>,

src/main_module/data/DataObject.rs renamed to src/main_module/data/data_object.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
#[derive(Debug)]
2626

2727
pub struct DataObject {
28-
fieldName: String,
28+
field_name: String,
2929
value: String,
3030
}
3131

3232
impl DataObject{
3333
pub fn new(field_name: &str, field_value: &str) -> Self {
3434
DataObject {
35-
fieldName: String::from(field_name),
35+
field_name: String::from(field_name),
3636
value: String::from(field_value),
3737
}
3838
}

src/main_module/data/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
* SOFTWARE.
2323
*/
2424

25-
pub mod DataHandler;
26-
pub mod DataObject;
27-
pub mod Table;
25+
pub mod data_handler;
26+
pub mod data_object;
27+
pub mod table;

src/main_module/data/Table.rs renamed to src/main_module/data/table.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ use std::collections::{HashSet, HashMap};
2626
use crate::DataObject;
2727

2828
pub struct Table {
29-
errorId: String,
30-
errorArg: String,
31-
errorRws: String,
32-
columnNames: HashSet<String>,
29+
error_id: String,
30+
error_arg: String,
31+
error_rws: String,
32+
column_names: HashSet<String>,
3333
rows: HashMap<String, Vec<DataObject>>,
3434
}
3535

3636
impl Table {
3737
pub fn new() -> Self {
3838
Table {
39-
errorId: String::from("[ERROR] [Incorrect ID]"),
40-
errorArg: String::from("[ERROR] [Incorrect rows in insert data package"),
41-
errorRws: String::from("[ERROR] [Trying to reach an empty row]"),
42-
columnNames: HashSet::new(),
39+
error_id: String::from("[ERROR] [Incorrect ID]"),
40+
error_arg: String::from("[ERROR] [Incorrect rows in insert data package"),
41+
error_rws: String::from("[ERROR] [Trying to reach an empty row]"),
42+
column_names: HashSet::new(),
4343
rows: HashMap::new(),
4444
}
4545
}

0 commit comments

Comments
 (0)