pub struct PostgresConnection { /* private fields */ }Expand description
Connection wrapper for Postgres/Tokio Postgres client.
Manages the client handle and background task used to drive the connection
and implements Executor for running queries against Postgres.
Trait Implementations§
Source§impl Connection for PostgresConnection
impl Connection for PostgresConnection
Source§async fn connect(url: Cow<'static, str>) -> Result<PostgresConnection>
async fn connect(url: Cow<'static, str>) -> Result<PostgresConnection>
Create a connection (or pool) with at least one underlying session
established to the given URL. Read more
Source§fn begin(&mut self) -> impl Future<Output = Result<PostgresTransaction<'_>>>
fn begin(&mut self) -> impl Future<Output = Result<PostgresTransaction<'_>>>
Begin a transaction scope tied to the current connection. Read more
Source§async fn disconnect(self) -> Result<()>
async fn disconnect(self) -> Result<()>
Disconnect and release the underlying session(s). Read more
fn sanitize_url(url: Cow<'static, str>) -> Result<Url, Error>
Source§impl Debug for PostgresConnection
impl Debug for PostgresConnection
Source§impl Executor for PostgresConnection
impl Executor for PostgresConnection
Source§type Driver = PostgresDriver
type Driver = PostgresDriver
Associated driver.
Source§async fn prepare(&mut self, sql: String) -> Result<Query<Self::Driver>>
async fn prepare(&mut self, sql: String) -> Result<Query<Self::Driver>>
Prepare a query for later execution.
Source§fn run<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Stream<Item = Result<QueryResult>> + Send
fn run<'s>( &'s mut self, query: impl AsQuery<Self::Driver> + 's, ) -> impl Stream<Item = Result<QueryResult>> + Send
Run a query, streaming
QueryResult items.Source§fn fetch<'s>(
&'s mut self,
query: impl AsQuery<Self::Driver> + 's,
) -> impl Stream<Item = Result<RowLabeled>> + Send
fn fetch<'s>( &'s mut self, query: impl AsQuery<Self::Driver> + 's, ) -> impl Stream<Item = Result<RowLabeled>> + Send
Stream only labeled rows (filters non-row results).
Source§async fn append<'a, E, It>(&mut self, entities: It) -> Result<RowsAffected>
async fn append<'a, E, It>(&mut self, entities: It) -> Result<RowsAffected>
Insert many entities efficiently.
Source§fn accepts_multiple_statements(&self) -> bool
fn accepts_multiple_statements(&self) -> bool
Returns true if the executor accepts multiple SQL statements in a single
request (e.g.
CREATE; INSERT; SELECT). Defaults to true.Auto Trait Implementations§
impl Freeze for PostgresConnection
impl !RefUnwindSafe for PostgresConnection
impl Send for PostgresConnection
impl Sync for PostgresConnection
impl Unpin for PostgresConnection
impl !UnwindSafe for PostgresConnection
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