add mssql
This commit is contained in:
22
src/check_postgres.rs
Normal file
22
src/check_postgres.rs
Normal 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(())
|
||||
}
|
||||
Reference in New Issue
Block a user