pub struct Pool { /* private fields */ }Expand description
connection pool for a set of connections to database. Can be used as entry point of query
§Examples
let pool = xitca_postgres::pool::Pool::builder("db_url").build()?;
xitca_postgres::Statement::named("SELECT 1", &[]).bind_none().execute(&pool).await?;§Caching
When connection pool is used as executor through Execute::query and Execute::execute methods
it would prepare and cache statement for reuse. For selective caching consider use PoolConnection
Implementations§
Source§impl Pool
impl Pool
Sourcepub fn builder<C>(cfg: C) -> PoolBuilder
pub fn builder<C>(cfg: C) -> PoolBuilder
start a builder of pool where it’s behavior can be configured.
Trait Implementations§
Source§impl<'c, 's> Execute<&'c Pool> for &'s strwhere
's: 'c,
Available on non-crate feature nightly only.
impl<'c, 's> Execute<&'c Pool> for &'s strwhere
's: 'c,
Available on non-crate feature
nightly only.Source§type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
outcome of execute.
used for single time database response: number of rows affected by execution for example.
Source§type QueryOutput = Pin<Box<dyn Future<Output = Result<GenericRowStream<Vec<Column>, NoTyped>, Error>> + Send + 'c>>
type QueryOutput = Pin<Box<dyn Future<Output = Result<GenericRowStream<Vec<Column>, NoTyped>, Error>> + Send + 'c>>
outcome of query.
used for repeated database response: database rows for example Read more
Source§fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
define how a statement is executed with single time response
Source§fn query(self, pool: &'c Pool) -> Self::QueryOutput
fn query(self, pool: &'c Pool) -> Self::QueryOutput
define how a statement is queried with repeated response
Source§impl<'c, 's, P, const N: usize> Execute<&'c Pool> for [StatementQuery<'s, P>; N]where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature nightly only.
impl<'c, 's, P, const N: usize> Execute<&'c Pool> for [StatementQuery<'s, P>; N]where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature
nightly only.Source§type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
outcome of execute.
used for single time database response: number of rows affected by execution for example.
Source§type QueryOutput = Pin<Box<dyn Future<Output = Result<Vec<GenericRowStream<Arc<[Column]>, Typed>>, Error>> + Send + 'c>>
type QueryOutput = Pin<Box<dyn Future<Output = Result<Vec<GenericRowStream<Arc<[Column]>, Typed>>, Error>> + Send + 'c>>
outcome of query.
used for repeated database response: database rows for example Read more
Source§fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
define how a statement is executed with single time response
Source§fn query(self, pool: &'c Pool) -> Self::QueryOutput
fn query(self, pool: &'c Pool) -> Self::QueryOutput
define how a statement is queried with repeated response
Source§impl<'c, 's, P> Execute<&'c Pool> for StatementQuery<'s, P>where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature nightly only.
impl<'c, 's, P> Execute<&'c Pool> for StatementQuery<'s, P>where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature
nightly only.Source§type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
outcome of execute.
used for single time database response: number of rows affected by execution for example.
Source§type QueryOutput = Pin<Box<dyn Future<Output = Result<GenericRowStream<Arc<[Column]>, Typed>, Error>> + Send + 'c>>
type QueryOutput = Pin<Box<dyn Future<Output = Result<GenericRowStream<Arc<[Column]>, Typed>, Error>> + Send + 'c>>
outcome of query.
used for repeated database response: database rows for example Read more
Source§fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
define how a statement is executed with single time response
Source§fn query(self, pool: &'c Pool) -> Self::QueryOutput
fn query(self, pool: &'c Pool) -> Self::QueryOutput
define how a statement is queried with repeated response
Source§impl<'c, 's, P> Execute<&'c Pool> for Vec<StatementQuery<'s, P>>where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature nightly only.
impl<'c, 's, P> Execute<&'c Pool> for Vec<StatementQuery<'s, P>>where
P: AsParams + Send + 'c,
's: 'c,
Available on non-crate feature
nightly only.Source§type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
type ExecuteOutput = Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'c>>
outcome of execute.
used for single time database response: number of rows affected by execution for example.
Source§type QueryOutput = Pin<Box<dyn Future<Output = Result<Vec<GenericRowStream<Arc<[Column]>, Typed>>, Error>> + Send + 'c>>
type QueryOutput = Pin<Box<dyn Future<Output = Result<Vec<GenericRowStream<Arc<[Column]>, Typed>>, Error>> + Send + 'c>>
outcome of query.
used for repeated database response: database rows for example Read more
Source§fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
fn execute(self, pool: &'c Pool) -> Self::ExecuteOutput
define how a statement is executed with single time response
Source§fn query(self, pool: &'c Pool) -> Self::QueryOutput
fn query(self, pool: &'c Pool) -> Self::QueryOutput
define how a statement is queried with repeated response
Auto Trait Implementations§
impl !Freeze for Pool
impl !RefUnwindSafe for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl UnsafeUnpin for Pool
impl !UnwindSafe for Pool
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
Mutably borrows from an owned value. Read more