Open ni2scmn opened 2 years ago
@BeaconBrigade @smklein I also get the trait bound error. Is there an easy fix that was forgotten in the example?
Hi @Vesafary, I've found the source of the issue. You're using an outdated version of bb8-diesel. When I made a pr to upgrade bb8-diesel to the newer version of bb8, @smklein merged my pr but didn't publish to crates.io (I'm assuming this is because they don't have permissions on the crate). This means to use the newer version you'll have to use the git version like so:
[dependencies]
bb8 = "0.8.0"
bb8-diesel = { git = "https://github.com/overdrivenpotato/bb8-diesel.git", version = "0.2.1" }
diesel = { version = "2.0.2", features = ["postgres"] }
tokio = { version = "1.22.0", features = ["full"] }
This is a bit annoying, but I don't know if this can be solved unless the original maintainer comes back. #10 shouldn't be necessary but let me know if any other issues arise.
Hmm, you seem to be right. Thanks for the answer, I'll remove my PR.
Hi! I tried to use git version and got compiler error:
error[E0432]: unresolved import `diesel::connection::ConnectionGatWorkaround`
--> /Users/xxx/.cargo/git/checkouts/bb8-diesel-3f90b18c23a445bc/89b7620/src/lib.rs:11:33
|
11 | AnsiTransactionManager, ConnectionGatWorkaround, LoadConnection, LoadRowIter,
| ^^^^^^^^^^^^^^^^^^^^^^^ no `ConnectionGatWorkaround` in `connection`
So, I can't use both crates.io and git version. @BeaconBrigade @smklein, can you watch the issue and fix at least git version, please?
My dependencies are:
[dependencies]
dotenvy = "0.15"
bb8 = "0.8.0"
bb8-diesel = { git = "https://github.com/overdrivenpotato/bb8-diesel.git", version = "0.2.1" }
diesel = { version = "2.0.2", features = ["postgres"] }
tokio = { version = "1.22.0", features = ["full"] }
Not sure what's going on, haven't messed with this in a long time, but did you try using the tokio 1.21? That's the version the library is using so that could be it.
Looks like you are using the right version of bb8 and diesel, so other than the tokio version, I'm not sure could be wrong. Maybe check you have the right features for each library.
This could also be an issue in the library but I don't have to time to really look into it.
These days I am using diesel-async, which already comes with its own integration with bb8 (and some other async pools), so not using this anymore. If interested, I can share a bit more, but it should be fairly straightforward with the docs themselves.
Problem is not int Tokio crate. bb8-diesel tries to import diesel::connection::ConnectionGatWorkaround
which my compiler can't resolve.
I will try to use diesel-async, thanks everyone!
Hi,
I tried to run the usage example but I do not get it compiled.
` use diesel::pg::PgConnection; use diesel::prelude::*;
table! { users (id) { id -> Integer, name -> Text, } }
[derive(AsChangeset, Identifiable, Queryable, Eq, PartialEq)]
[diesel(table_name = users)]
pub struct User { pub id: i32, pub name: String, }
[tokio::main]
async fn main() { use users::dsl;
} `
My dependencies:
bb8 = { version = "0.8.0"} bb8-diesel = { version = "0.2.1"} diesel = { version = "2.0.2", features = ["postgres"]} tokio = { version = "1.21.2", features = ["full"] }
error[E0277]: the trait bound
DieselConnectionManagerManageConnection
is not implemented forDieselConnectionManager<PgConnection>
note: required by a bound in Pool {
| ^^^^^^^^^^^^^^^^ required by this bound in
Pool::<M>::builder
--> /Users/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/bb8-0.8.0/src/api.rs:42:9 | 42 | implPool::<M>::builder
DieselConnectionManager<PgConnection>: ManageConnection
is not satisfied --> src/main.rs:23:16ManageConnection
is not implemented forDieselConnectionManager<PgConnection>
note: required by a bound in
Pool
--> /Users/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/bb8-0.8.0/src/api.rs:17:8 | 17 | M: ManageConnection, | ^^^^^^^^^^^^^^^^ required by this bound inPool
DieselConnectionManager<PgConnection>: ManageConnection
is not satisfied --> src/main.rs:23:37ManageConnection
is not implemented forDieselConnectionManager<PgConnection>
note: required by a bound in Builder {
| ^^^^^^^^^^^^^^^^ required by this bound in
bb8::Builder::<M>::build
--> /Users/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/bb8-0.8.0/src/api.rs:118:9 | 118 | implbb8::Builder::<M>::build
error[E0277]: the trait bound
DieselConnectionManager<PgConnection>: ManageConnection
is not satisfied --> src/main.rs:23:51 | 23 | let pool = bb8::Pool::builder().build(manager).await.unwrap(); | ^^^^^^ the traitManageConnection
is not implemented forDieselConnectionManager<PgConnection>
DieselConnectionManager<PgConnection>: ManageConnection
is not satisfied --> src/main.rs:23:16ManageConnection
is not implemented forDieselConnectionManager<PgConnection>
note: required by a bound in
Pool
--> /Users/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/bb8-0.8.0/src/api.rs:17:8`Do you have any suggestions or plans on fixing this?