Trait postgres::GenericClient
source · pub trait GenericClient: Sealed {
Show 14 methods
// Required methods
fn execute<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<u64, Error>
where T: ?Sized + ToStatement;
fn query<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Vec<Row>, Error>
where T: ?Sized + ToStatement;
fn query_one<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Row, Error>
where T: ?Sized + ToStatement;
fn query_opt<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Option<Row>, Error>
where T: ?Sized + ToStatement;
fn query_raw<T, P, I>(
&mut self,
query: &T,
params: I,
) -> Result<RowIter<'_>, Error>
where T: ?Sized + ToStatement,
P: BorrowToSql,
I: IntoIterator<Item = P>,
I::IntoIter: ExactSizeIterator;
fn query_typed(
&mut self,
statement: &str,
params: &[(&(dyn ToSql + Sync), Type)],
) -> Result<Vec<Row>, Error>;
fn query_typed_raw<P, I>(
&mut self,
statement: &str,
params: I,
) -> Result<RowIter<'_>, Error>
where P: BorrowToSql,
I: IntoIterator<Item = (P, Type)> + Sync + Send;
fn prepare(&mut self, query: &str) -> Result<Statement, Error>;
fn prepare_typed(
&mut self,
query: &str,
types: &[Type],
) -> Result<Statement, Error>;
fn copy_in<T>(&mut self, query: &T) -> Result<CopyInWriter<'_>, Error>
where T: ?Sized + ToStatement;
fn copy_out<T>(&mut self, query: &T) -> Result<CopyOutReader<'_>, Error>
where T: ?Sized + ToStatement;
fn simple_query(
&mut self,
query: &str,
) -> Result<Vec<SimpleQueryMessage>, Error>;
fn batch_execute(&mut self, query: &str) -> Result<(), Error>;
fn transaction(&mut self) -> Result<Transaction<'_>, Error>;
}
Expand description
A trait allowing abstraction over connections and transactions.
This trait is “sealed”, and cannot be implemented outside of this crate.
Required Methods§
sourcefn execute<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<u64, Error>where
T: ?Sized + ToStatement,
fn execute<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<u64, Error>where
T: ?Sized + ToStatement,
Like Client::execute
.
sourcefn query<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Vec<Row>, Error>where
T: ?Sized + ToStatement,
fn query<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Vec<Row>, Error>where
T: ?Sized + ToStatement,
Like Client::query
.
sourcefn query_one<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Row, Error>where
T: ?Sized + ToStatement,
fn query_one<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Row, Error>where
T: ?Sized + ToStatement,
Like Client::query_one
.
sourcefn query_opt<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Option<Row>, Error>where
T: ?Sized + ToStatement,
fn query_opt<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Option<Row>, Error>where
T: ?Sized + ToStatement,
Like Client::query_opt
.
sourcefn query_raw<T, P, I>(
&mut self,
query: &T,
params: I,
) -> Result<RowIter<'_>, Error>where
T: ?Sized + ToStatement,
P: BorrowToSql,
I: IntoIterator<Item = P>,
I::IntoIter: ExactSizeIterator,
fn query_raw<T, P, I>(
&mut self,
query: &T,
params: I,
) -> Result<RowIter<'_>, Error>where
T: ?Sized + ToStatement,
P: BorrowToSql,
I: IntoIterator<Item = P>,
I::IntoIter: ExactSizeIterator,
Like Client::query_raw
.
sourcefn query_typed(
&mut self,
statement: &str,
params: &[(&(dyn ToSql + Sync), Type)],
) -> Result<Vec<Row>, Error>
fn query_typed( &mut self, statement: &str, params: &[(&(dyn ToSql + Sync), Type)], ) -> Result<Vec<Row>, Error>
Like Client::query_typed
sourcefn query_typed_raw<P, I>(
&mut self,
statement: &str,
params: I,
) -> Result<RowIter<'_>, Error>
fn query_typed_raw<P, I>( &mut self, statement: &str, params: I, ) -> Result<RowIter<'_>, Error>
sourcefn prepare_typed(
&mut self,
query: &str,
types: &[Type],
) -> Result<Statement, Error>
fn prepare_typed( &mut self, query: &str, types: &[Type], ) -> Result<Statement, Error>
Like Client::prepare_typed
.
sourcefn copy_in<T>(&mut self, query: &T) -> Result<CopyInWriter<'_>, Error>where
T: ?Sized + ToStatement,
fn copy_in<T>(&mut self, query: &T) -> Result<CopyInWriter<'_>, Error>where
T: ?Sized + ToStatement,
Like Client::copy_in
.
sourcefn copy_out<T>(&mut self, query: &T) -> Result<CopyOutReader<'_>, Error>where
T: ?Sized + ToStatement,
fn copy_out<T>(&mut self, query: &T) -> Result<CopyOutReader<'_>, Error>where
T: ?Sized + ToStatement,
Like Client::copy_out
.
sourcefn simple_query(
&mut self,
query: &str,
) -> Result<Vec<SimpleQueryMessage>, Error>
fn simple_query( &mut self, query: &str, ) -> Result<Vec<SimpleQueryMessage>, Error>
Like Client::simple_query
.
sourcefn transaction(&mut self) -> Result<Transaction<'_>, Error>
fn transaction(&mut self) -> Result<Transaction<'_>, Error>
Like Client::transaction
.
Object Safety§
This trait is not object safe.