You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
391 B
16 lines
391 B
use std::sync::Arc; |
|
|
|
use sqlx::{Any, Pool}; |
|
|
|
mod entity; |
|
|
|
#[tokio::main] |
|
async fn main() { |
|
let record = entity::Entity::new(1, "Something"); |
|
let pool = Arc::new( |
|
Pool::<Any>::connect(&std::env::var("DATABASE_URL").expect("I need DATABASE_URL set!")) |
|
.await |
|
.expect("Failed to connect to the database"), |
|
); |
|
record.save(&pool).await.unwrap(); |
|
}
|
|
|