Skip to content

Commit

Permalink
Fix fmt setting (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
chansuke authored Mar 19, 2021
1 parent 6689a67 commit c6ebc4a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 38 deletions.
11 changes: 11 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
format_code_in_doc_comments = true
match_block_trailing_comma = true
overflow_delimited_expr = true
normalize_comments = true
reorder_impl_items = true
use_try_shorthand = true
newline_style = "Unix"
format_strings = true
wrap_comments = true
comment_width = 100

40 changes: 10 additions & 30 deletions src/db/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use rusqlite::Connection;
use rusqlite::NO_PARAMS;

pub fn create_tables(conn: &Connection) {
/*
* google_my_activity
*/
// google_my_activity
conn.execute(
"CREATE TABLE IF NOT EXISTS google_my_activity (
uuid TEXT NOT NULL PRIMARY KEY,
Expand All @@ -19,9 +17,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* activity_location_info
*/
// activity_location_info
conn.execute(
"CREATE TABLE IF NOT EXISTS activity_location_info (
id INTEGER PRIMARY KEY,
Expand All @@ -43,9 +39,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* activity_sub_title
*/
// activity_sub_title
conn.execute(
"CREATE TABLE IF NOT EXISTS activity_sub_title (
id INTEGER PRIMARY KEY,
Expand All @@ -66,9 +60,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* activity_details
*/
// activity_details
conn.execute(
"CREATE TABLE IF NOT EXISTS activity_details (
id INTEGER PRIMARY KEY,
Expand All @@ -88,9 +80,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* activity_products
*/
// activity_products
conn.execute(
"CREATE TABLE IF NOT EXISTS activity_products (
id INTEGER PRIMARY KEY,
Expand All @@ -110,9 +100,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* google_location_history
*/
// google_location_history
conn.execute(
"CREATE TABLE IF NOT EXISTS google_location_history (
id INTEGER PRIMARY KEY,
Expand All @@ -133,9 +121,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* google_saved_places
*/
// google_saved_places
conn.execute(
"CREATE TABLE IF NOT EXISTS google_saved_places (
id INTEGER PRIMARY KEY,
Expand All @@ -153,9 +139,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* facebook_device_location
*/
// facebook_device_location
conn.execute(
"CREATE TABLE IF NOT EXISTS facebook_device_location (
id INTEGER PRIMARY KEY,
Expand All @@ -167,9 +151,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* facebook_primary_location
*/
// facebook_primary_location
conn.execute(
"CREATE TABLE IF NOT EXISTS facebook_primary_location (
id INTEGER PRIMARY KEY,
Expand All @@ -181,9 +163,7 @@ pub fn create_tables(conn: &Connection) {
.map_err(|err| println!("{:?}", err))
.ok();

/*
* facebook_primary_public_location
*/
// facebook_primary_public_location
conn.execute(
"CREATE TABLE IF NOT EXISTS facebook_primary_public_location (
id INTEGER PRIMARY KEY,
Expand Down
16 changes: 8 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Opt {
command: String,
directory_name: String,
//#[structopt(parse(from_os_str))]
//file: PathBuf,
// file: PathBuf,
#[structopt(short = "d", long = "dbfile", default_value = "ichnion.db")]
dbfile: String,
}
Expand Down Expand Up @@ -54,7 +54,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
elem.saveToDb(&conn)?;
}
println!("( {} records )", result.len());
}
},
"Location\tHistory.json" => {
print!("processing {}", d_name);

Expand All @@ -65,7 +65,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
result.saveToDb(&conn)?;

println!("( {} records )", result.locations.len());
}
},
"Saved\tPlace.json" => {
println!("processing {}", d_name);

Expand All @@ -74,7 +74,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let result: saved_places::SavedPlace = serde_json::from_str(&rawdata)?;

result.saveToDb(&conn)?;
}
},
"Semantic\tLocation\tHistory.json" => {
println!("processing {}", d_name);

Expand All @@ -85,7 +85,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

println!("( {} records )", result.timelineObjects.len());
result.saveToDb(&conn)?;
}
},
// Facebook activities
"device_location.json" => {
println!("processing {}", d_name);
Expand All @@ -98,7 +98,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

println!("( {} records )", result.phone_number_location.len());
println!("{:?}", response);
}
},
"primary_location.json" => {
println!("processing {}", d_name);

Expand All @@ -113,7 +113,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
result.primary_location.city_region_pairs.len()
);
println!("{:?}", response);
}
},
"primary_public_location.json" => {
println!("processing {}", d_name);

Expand All @@ -124,7 +124,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let response = result.saveToDb(&conn)?;
println!("{:?}", response);
}
},
_ => println!("No files are matched"),
}
}
Expand Down

0 comments on commit c6ebc4a

Please sign in to comment.