use option version
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
use log::info;
|
||||
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use sqlx::postgres::{
|
||||
PgConnectOptions,
|
||||
PgPoolOptions,
|
||||
};
|
||||
|
||||
pub async fn check_postgres() -> Result<(), sqlx::Error> {
|
||||
// "postgres://demo_user:demo_pass@localhost:8087/demo"
|
||||
let options = PgConnectOptions::new()
|
||||
.host("localhost")
|
||||
.port(8087)
|
||||
.database("demo")
|
||||
.username("demo_user")
|
||||
.password("demo_pass");
|
||||
|
||||
let pool = PgPoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect("postgres://demo_user:demo_pass@localhost:8087/demo")
|
||||
.connect_with(options)
|
||||
.await?;
|
||||
|
||||
// Make a simple query to return the given parameter
|
||||
|
||||
Reference in New Issue
Block a user