Trait please::ConnectionProvider
source · pub trait ConnectionProvider {
type Error;
type Connection: Connection<Backend = Pg>;
fn get(&self) -> Result<Self::Connection, Self::Error>;
}
Expand description
Trait for types providing database connections. This is typically
implemented by an Arc<ConnectionPool>
or functionally equivalent
type.
Required Associated Types§
sourcetype Error
type Error
Error type which may be returned when the provider is unable to obtain a database connection.
sourcetype Connection: Connection<Backend = Pg>
type Connection: Connection<Backend = Pg>
Type of the connection returned. Currently the connection must use the postgres backend.
Required Methods§
sourcefn get(&self) -> Result<Self::Connection, Self::Error>
fn get(&self) -> Result<Self::Connection, Self::Error>
Obtain a connection from this provider.