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
I'm trying to start a transaction and return it for later usage but i get lifetime issues because the lifetime of the transaction is tied to the client/connection. Is there a proper way to do this? I've tried wrapping the Transaction in a struct, using Box and tokio Mutex but nothing seemed to help
see below pseudo code.
#[async_trait]traitmyTrait{asyncfnstart() -> Transaction{letmut client = self.get().await.unwrap();// Get the client from the pool letmut transaction = client.transaction().await.unwrap();// do some stuff with transaction
transaction
}}
using the following core libs
tokio = { version = "1.38", features = ["macros", "rt-multi-thread", "signal"] }
tokio-postgres = { version = "0.7", features = ["runtime", "array-impls"] }
tokio-postgres-rustls = "0.13"bb8 = "0.9"bb8-postgres = "0.9"warp = "0.3"async-trait = "0.1"
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
I'm trying to start a transaction and return it for later usage but i get lifetime issues because the lifetime of the transaction is tied to the client/connection. Is there a proper way to do this? I've tried wrapping the Transaction in a struct, using Box and tokio Mutex but nothing seemed to help
see below pseudo code.
using the following core libs
The text was updated successfully, but these errors were encountered: