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

22
src/check_postgres.rs Normal file
View File

@@ -0,0 +1,22 @@
use log::info;
use sqlx::postgres::PgPoolOptions;
pub async fn check_postgres() -> Result<(), sqlx::Error> {
let pool = PgPoolOptions::new()
.max_connections(5)
.connect("postgres://demo_user:demo_pass@localhost:8087/demo")
.await?;
// Make a simple query to return the given parameter
let row: (i64,) = sqlx::query_as("SELECT $1")
.bind(150_i64)
.fetch_one(&pool)
.await?;
assert_eq!(row.0, 150);
info!("Received {}", row.0);
Ok(())
}