Need to make PSQLPool.connection() method sync and add async context manager to it.
Main idea:
connection method will create new Connection(1) object with structure connection: None, db_pool: . And when user will call any method on connection(1), we need to acquire db pool for read, retrieve new connection(2), put it in our Connection(1) object and then use only connection(2) for querying.
Add async context manager like in Transaction.
Try to add close() method for connection(1) to use Drop trait.
Need to make. And when user will call any method on connection(1), we need to acquire db pool for read, retrieve new connection(2), put it in our
PSQLPool.connection()
method sync and add async context manager to it.Main idea:
connection
method will create newConnection
(1) object with structure connection: None, db_pool:Connection
(1) object and then use only connection(2) for querying.Add async context manager like in
Transaction
.Try to add close() method for connection(1) to use
Drop
trait.