pub struct SharedPgConnection { /* private fields */ }Expand description
Shared, cloneable PostgreSQL connection with interior mutability.
Implementations§
Trait Implementations§
Source§type Tx<'conn> = SharedPgTransaction<'conn>
where
Self: 'conn
type Tx<'conn> = SharedPgTransaction<'conn> where Self: 'conn
The transaction type returned by this connection.
Source§fn query(
&self,
cx: &Cx,
sql: &str,
params: &[Value],
) -> impl Future<Output = Outcome<Vec<Row>, Error>> + Send
fn query( &self, cx: &Cx, sql: &str, params: &[Value], ) -> impl Future<Output = Outcome<Vec<Row>, Error>> + Send
Execute a query and return all rows.
Source§fn query_one(
&self,
cx: &Cx,
sql: &str,
params: &[Value],
) -> impl Future<Output = Outcome<Option<Row>, Error>> + Send
fn query_one( &self, cx: &Cx, sql: &str, params: &[Value], ) -> impl Future<Output = Outcome<Option<Row>, Error>> + Send
Execute a query and return the first row, if any.
Source§fn execute(
&self,
cx: &Cx,
sql: &str,
params: &[Value],
) -> impl Future<Output = Outcome<u64, Error>> + Send
fn execute( &self, cx: &Cx, sql: &str, params: &[Value], ) -> impl Future<Output = Outcome<u64, Error>> + Send
Execute a statement (INSERT, UPDATE, DELETE) and return rows affected.
Source§fn insert(
&self,
cx: &Cx,
sql: &str,
params: &[Value],
) -> impl Future<Output = Outcome<i64, Error>> + Send
fn insert( &self, cx: &Cx, sql: &str, params: &[Value], ) -> impl Future<Output = Outcome<i64, Error>> + Send
Execute an INSERT and return the last inserted ID. Read more
Source§fn batch(
&self,
cx: &Cx,
statements: &[(String, Vec<Value>)],
) -> impl Future<Output = Outcome<Vec<u64>, Error>> + Send
fn batch( &self, cx: &Cx, statements: &[(String, Vec<Value>)], ) -> impl Future<Output = Outcome<Vec<u64>, Error>> + Send
Execute multiple statements in a batch. Read more
Source§fn begin(
&self,
cx: &Cx,
) -> impl Future<Output = Outcome<Self::Tx<'_>, Error>> + Send
fn begin( &self, cx: &Cx, ) -> impl Future<Output = Outcome<Self::Tx<'_>, Error>> + Send
Begin a transaction with default isolation level (ReadCommitted).
Source§fn begin_with(
&self,
cx: &Cx,
isolation: IsolationLevel,
) -> impl Future<Output = Outcome<Self::Tx<'_>, Error>> + Send
fn begin_with( &self, cx: &Cx, isolation: IsolationLevel, ) -> impl Future<Output = Outcome<Self::Tx<'_>, Error>> + Send
Begin a transaction with a specific isolation level.
Source§fn prepare(
&self,
cx: &Cx,
sql: &str,
) -> impl Future<Output = Outcome<PreparedStatement, Error>> + Send
fn prepare( &self, cx: &Cx, sql: &str, ) -> impl Future<Output = Outcome<PreparedStatement, Error>> + Send
Prepare a statement for repeated execution. Read more
Source§fn query_prepared(
&self,
cx: &Cx,
stmt: &PreparedStatement,
params: &[Value],
) -> impl Future<Output = Outcome<Vec<Row>, Error>> + Send
fn query_prepared( &self, cx: &Cx, stmt: &PreparedStatement, params: &[Value], ) -> impl Future<Output = Outcome<Vec<Row>, Error>> + Send
Execute a prepared statement and return all rows.
Source§fn execute_prepared(
&self,
cx: &Cx,
stmt: &PreparedStatement,
params: &[Value],
) -> impl Future<Output = Outcome<u64, Error>> + Send
fn execute_prepared( &self, cx: &Cx, stmt: &PreparedStatement, params: &[Value], ) -> impl Future<Output = Outcome<u64, Error>> + Send
Execute a prepared statement (INSERT, UPDATE, DELETE) and return rows affected.
Auto Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).