Giter Club home page Giter Club logo

Comments (6)

mpiorowski avatar mpiorowski commented on July 19, 2024 1

I was able to make it work by setting the type to: deadpool::managed::Pool<AsyncDieselConnectionManager<AsyncPgConnection>>

Dont know if that is the proper setup :)

image

from diesel_async.

mpiorowski avatar mpiorowski commented on July 19, 2024 1

@weiznich Yes, sorry, i was playing with different pool providers, so there might be some misunderstanding. But I still believe something is not right here. Cleaned code to show the problem.

pub struct MyService {
    // This one is throwing the error
    // pool: diesel_async::pooled_connection::deadpool::Pool<
    //     diesel_async::pooled_connection::AsyncDieselConnectionManager<
    //         diesel_async::AsyncPgConnection,
    //     >,
    // >,
    // this one require me to install deadpool cargo seperate, but everything here works
    pool: deadpool::managed::Pool<
        diesel_async::pooled_connection::AsyncDieselConnectionManager<
            diesel_async::AsyncPgConnection,
        >,
    >,
}

image

And ofc fn to create a poll is taken from the docs, using diesel_async types:

pub fn establish_connection(database_url: &str) -> Result<Pool<AsyncPgConnection>> {
    let config = AsyncDieselConnectionManager::<AsyncPgConnection>::new(database_url);
    let pool = Pool::builder(config)
        .build()
        .context("Error creating pool")?;
    return Ok(pool);
}

from diesel_async.

mpiorowski avatar mpiorowski commented on July 19, 2024 1

The solution here is to diesel_async::pooled_connection::bb8::Pool<AsyncPgConnection>

from diesel_async.

weiznich avatar weiznich commented on July 19, 2024

Closed because it seems like you've just mixed up different types with the name Pool.
For future similar questions: Please use the support forum as the issue tracker is for tracking bugs.

from diesel_async.

sergey-suslov avatar sergey-suslov commented on July 19, 2024

I have the same issue

[dependencies]
diesel = { version = "2.1.0", features = [
  "postgres",
  "r2d2",
  "uuid",
  "chrono",
] }
diesel-async = { version = "0.3.1", features = ["postgres", "bb8"] }
use diesel_async::pooled_connection::bb8::Pool;
use diesel_async::pooled_connection::AsyncDieselConnectionManager;
use diesel_async::AsyncPgConnection;

pub type AsyncPool =
    diesel_async::pooled_connection::bb8::Pool<AsyncDieselConnectionManager<AsyncPgConnection>>;

#[derive(Clone)]
pub struct AccountRepository {
    db: AsyncPool,
}
error[E0277]: the trait bound `AsyncDieselConnectionManager<AsyncPgConnection>: PoolableConnection` is not satisfied
  --> crates/shared/src/lib.rs:10:9
   |
10 |     db: AsyncPool,
   |         ^^^^^^^^^ the trait `PoolableConnection` is not implemented for `AsyncDieselConnectionManager<AsyncPgConnection>`

from diesel_async.

weiznich avatar weiznich commented on July 19, 2024

Please do not use the issue tracker to discuss support issues. It's a place for technical discussions about features and bugs. It's not meant to be a support forum.

from diesel_async.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.