YES
This commit is contained in:
27
backend/src/main.rs
Normal file
27
backend/src/main.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use dotenv::dotenv;
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use std::env;
|
||||
|
||||
pub mod admin_data;
|
||||
pub mod driver_data;
|
||||
pub mod pog;
|
||||
pub mod radar_data;
|
||||
pub mod ticket_data;
|
||||
pub mod vehicle_data;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> Result<(), sqlx::Error> {
|
||||
dotenv().ok();
|
||||
let database_url = env::var("DATABASE_URL").expect("Put a DB url in the .env file dumbass");
|
||||
let pool = PgPoolOptions::new()
|
||||
.max_connections(10)
|
||||
.connect(database_url.as_str())
|
||||
.await?;
|
||||
let row: (i64,) = sqlx::query_as("SELECT $1 FROM drivers")
|
||||
.bind(150_i64)
|
||||
.fetch_one(&pool)
|
||||
.await?;
|
||||
assert_eq!(row.0, 150);
|
||||
println!("my nuts {}", row.0);
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user