-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor find missing data script to Rust
- Loading branch information
1 parent
6e42be2
commit e0fb457
Showing
4 changed files
with
76 additions
and
32 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use crate::{ | ||
extract::{get_html_from_url, ExtractionPreference}, | ||
mariadb, | ||
}; | ||
use mariadb_mysql_kbs::{merged_ultraslim::SearchType, search}; | ||
use reqwest::blocking::Client; | ||
|
||
pub fn run(only: ExtractionPreference) { | ||
println!("Run checking..."); | ||
match only { | ||
ExtractionPreference::All => { | ||
check_mariadb(); | ||
} | ||
ExtractionPreference::MySQL => {} | ||
ExtractionPreference::MariaDB => { | ||
check_mariadb(); | ||
} | ||
}; | ||
|
||
println!("All done."); | ||
println!("End !"); | ||
} | ||
|
||
fn check_mariadb() { | ||
check_mariadb_url("https://mariadb.com/kb/en/mysqld-options/"); | ||
check_mariadb_url("https://mariadb.com/kb/en/server-system-variables/"); | ||
check_mariadb_url("https://mariadb.com/kb/en/server-status-variables/"); | ||
} | ||
|
||
fn check_mariadb_url(url: &str) { | ||
let client = Client::new(); | ||
println!("Checking URL: {}", url); | ||
let response = get_html_from_url(client, url); | ||
let data = mariadb::extract_mariadb_from_text(response); | ||
let loaded_data = search::load_data(); | ||
for entry in data { | ||
if entry.name.is_some() { | ||
let entry_name = entry.name.unwrap(); | ||
match loaded_data.get_by_name(&entry_name, SearchType::MariaDB) { | ||
Ok(_) => {} | ||
Err(_) => { | ||
if !entry_name.starts_with("--") { | ||
println!("Missing: {:?}", entry_name); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters