Closed rbalicki2 closed 7 years ago
PooledConnection
derefs to PgConnection
, so .get_result(&*conn)
should work.
Yes, this works - thank you! I forgot the deref. Time to brush up...
Well, this &*conn
deserves to be documented... I am new to diesel and r2d2, so if somebody more knowledgeable adds a nice example to the README or documentation, that would be great!
Thank you!
Hello,
I have a connection pool, implemented like in writing a github webhook in rust pt 1, code at this link. I'm not sure what I am doing wrong, but when I call
I get the following error message:
diesel::pg::PgConnection
implementsdiesel::Connection
. Is there any way to convert from a pooled connection to a regular connection? It doesn't look like it from the docs.My workaround is to call the
establish_connection
method (from the same link as above), which returns aPgConnection
. However, grabbing a pooled connection or a regular connection depending on whether we're inserting or querying seems really fishy.Am I doing something wrong? Thank you!