[−][src]Struct deadpool_postgres::config::Config
Configuration object. By enabling the config
feature you can
read the configuration using the config
crate.
Example environment
PG_HOST=pg.example.com
PG_USER=john_doe
PG_PASSWORD=topsecret
PG_DBNAME=example
PG_POOL.MAX_SIZE=16
PG_POOL.TIMEOUTS.WAIT.SECS=5
PG_POOL.TIMEOUTS.WAIT.NANOS=0
Example usage
Config::from_env("PG");
Fields
user: Option<String>
See tokio_postgres::Config::user
password: Option<String>
See tokio_postgres::Config::password
dbname: Option<String>
See tokio_postgres::Config::dbname
options: Option<String>
See tokio_postgres::Config::options
application_name: Option<String>
See tokio_postgres::Config::application_name
ssl_mode: Option<SslMode>
See tokio_postgres::Config::ssl_mode
host: Option<String>
This is similar to hosts
but only allows one host to be specified.
Unlike tokio-postgres::Config
this structure differenciates between
one host and more than one host. This makes it possible to store this
configuration in an envorinment variable.
See tokio_postgres::Config::host
hosts: Option<Vec<String>>
See tokio_postgres::Config::hosts
port: Option<u16>
This is similar to ports
but only allows one port to be specified.
Unlike tokio-postgres::Config
this structure differenciates between
one port and more than one port. This makes it possible to store this
configuration in an environment variable.
See tokio_postgres::Config::port
ports: Option<Vec<u16>>
See tokio_postgres::Config::port
connect_timeout: Option<Duration>
See tokio_postgres::Config::connect_timeout
keepalives: Option<bool>
See tokio_postgres::Config::keepalives
keepalives_idle: Option<Duration>
See tokio_postgres::Config::keepalives_idle
target_session_attrs: Option<TargetSessionAttrs>
See tokio_postgres::Config::target_session_attrs
channel_binding: Option<ChannelBinding>
See tokio_postgres::Config::channel_binding
manager: Option<ManagerConfig>
Manager configuration
pool: Option<PoolConfig>
Pool configuration
Implementations
impl Config
[src]
pub fn new() -> Self
[src]
Create new config instance with default values. This function is
identical to Config::default
.
pub fn from_env(prefix: &str) -> Result<Self, ConfigError>
[src]
Please embed this structure in your own config structure and use config::Config
directly.
Create configuration from environment variables.
pub fn create_pool<T>(&self, tls: T) -> Result<Pool, ConfigError> where
T: MakeTlsConnect<Socket> + Clone + Sync + Send + 'static,
T::Stream: Sync + Send,
T::TlsConnect: Sync + Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
[src]
T: MakeTlsConnect<Socket> + Clone + Sync + Send + 'static,
T::Stream: Sync + Send,
T::TlsConnect: Sync + Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
Create pool using the current configuration
pub fn get_pg_config(&self) -> Result<Config, ConfigError>
[src]
Get tokio_postgres::Config
which can be used to connect to
the database.
pub fn get_manager_config(&self) -> ManagerConfig
[src]
Get deadpool_postgres::ManagerConfig
which can be used to
construct a deadpool::managed::Pool
instance.
pub fn get_pool_config(&self) -> PoolConfig
[src]
Get deadpool::PoolConfig
which can be used to construct a
deadpool::managed::Pool
instance.
Trait Implementations
impl Clone for Config
[src]
impl Debug for Config
[src]
impl Default for Config
[src]
impl<'de> Deserialize<'de> for Config
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,