You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[dependencies.rocket]
version = "0.5.0-rc.2"
features = ["json"][dependencies.rocket_sync_db_pools]
version = "0.1.0-rc.2"
features = ["diesel_postgres_pool"][dependencies]
diesel = { version = "2.0.0", features = ["postgres"]}
dotenvy = "0.15"
use diesel::prelude::*;use rocket_sync_db_pools::database;#[database("my_db")]structDB(rocket_sync_db_pools::diesel::PgConnection);#[get("/posts")]// Getting all Posts and their Userasyncfnposts(conn:DB) -> Json<Vec<Post,User>>{use schema::posts::dsl::*;Json(
conn
.run(|c| posts.inner_join(users::table).load::<(Post,User)>(c)).await.expect("Error loading posts"),)}#[launch]fnrocket() -> _{
rocket::build().attach(DB::fairing()).mount("/",routes![posts])}
Unfortunately this doesn't compile and gives me the following error pointing to the c parameter of the load function:
the trait `LoadConnection` is not implemented for `rocket_sync_db_pools::diesel::PgConnection`
Any idea how to solve this? I'm suspecting a collision between diesel and rocket_sync_db_pools::diesel, but can't figure it out.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm trying to connect my
Rocket
app to myPostgres
database using Diesel and rocket_sync_db_poolsUnfortunately this doesn't compile and gives me the following error pointing to the
c
parameter of theload
function:Any idea how to solve this? I'm suspecting a collision between
diesel
androcket_sync_db_pools::diesel
, but can't figure it out.Thank you.
Beta Was this translation helpful? Give feedback.
All reactions