add mssql

This commit is contained in:
2021-08-19 21:40:06 -05:00
parent 50e78602f3
commit fe01037749
6 changed files with 127 additions and 98 deletions

19
src/check_mysql.rs Normal file
View File

@@ -0,0 +1,19 @@
use log::info;
use sqlx::mysql::MySqlPoolOptions;
pub async fn check_mysql() -> Result<(), sqlx::Error> {
let pool = MySqlPoolOptions::new()
.max_connections(5)
.connect("mysql://demo_user:demo_pass@localhost:8086/demo")
.await?;
// Make a simple query to return the given parameter
let row = sqlx::query("SELECT * from events")
.fetch_all(&pool)
.await?;
info!("Received {:?}", row);
Ok(())
}