pub struct PoolConfig {
pub uri: String,
pub min_connections: u32,
pub max_connections: u32,
pub connect_timeout_ms: u64,
pub idle_timeout_ms: u64,
pub statement_timeout_ms: u64,
pub application_name: String,
pub read_only: bool,
}Expand description
Pool settings.
Fields§
§uri: StringConnection string.
min_connections: u32Connections kept open.
max_connections: u32Largest number of connections.
connect_timeout_ms: u64How long to wait for a connection, in milliseconds.
idle_timeout_ms: u64How long an idle connection stays open, in milliseconds.
statement_timeout_ms: u64Postgres’s statement_timeout on every connection, in milliseconds. 0 sets
none.
application_name: StringPostgres’s application_name on every connection, so pg_stat_activity says
which service a query came from. Empty sets none.
read_only: boolOpen every transaction read-only, as for a read replica or a reporting service, so that a write is refused by the database.
Implementations§
Source§impl PoolConfig
impl PoolConfig
Source§impl PoolConfig
impl PoolConfig
Sourcepub fn connection_uri(&self) -> Result<String, Error>
pub fn connection_uri(&self) -> Result<String, Error>
The connection string with the session settings added, as every connection
connect opens uses.
§Errors
sqlx::Error::Configuration when the URL sets options already and a
statement timeout or read-only mode is set here too, or when the application
name is not one Postgres keeps as it is.
Trait Implementations§
Source§impl Clone for PoolConfig
impl Clone for PoolConfig
Source§impl Debug for PoolConfig
impl Debug for PoolConfig
impl Eq for PoolConfig
Source§impl PartialEq for PoolConfig
impl PartialEq for PoolConfig
impl StructuralPartialEq for PoolConfig
Auto Trait Implementations§
impl Forget for PoolConfig
impl Freeze for PoolConfig
impl Move for PoolConfig
impl RefUnwindSafe for PoolConfig
impl Send for PoolConfig
impl Sync for PoolConfig
impl Unpin for PoolConfig
impl UnsafeUnpin for PoolConfig
impl UnwindSafe for PoolConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more