pub trait Connection<R>where
R: Row,{
// Required methods
fn flavor(&self) -> Flavor;
fn execute_with_params<S, P>(&mut self, query: S, params: &P) -> Result<()>
where S: AsRef<str>,
P: Params;
fn execute_with_params_iterator<'a, S, I, P>(
&mut self,
query: S,
params_iter: I,
) -> Result<()>
where S: AsRef<str>,
P: Params + 'a,
I: IntoIterator<Item = &'a P>;
fn query<S>(&mut self, query: S) -> Result<Vec<R>>
where S: AsRef<str>;
// Provided methods
fn query_try_as_object<S, T>(&mut self, query: S) -> Result<Vec<T>>
where S: AsRef<str>,
T: TryFromRefRow<R> { ... }
fn query_first<S>(&mut self, query: S) -> Result<Option<R>>
where S: AsRef<str> { ... }
fn query_first_try_as_object<S, T>(&mut self, query: S) -> Result<Option<T>>
where S: AsRef<str>,
T: TryFromRefRow<R> { ... }
fn query_drop<S>(&mut self, query: S) -> Result<()>
where S: AsRef<str> { ... }
}
Expand description
Generic trait to be implemented by SQL drivers (or proxy to SQL drivers). This trait is used to provide the basis of the functionalities on which the crate rely
Required Methods§
Sourcefn execute_with_params<S, P>(&mut self, query: S, params: &P) -> Result<()>
fn execute_with_params<S, P>(&mut self, query: S, params: &P) -> Result<()>
Implements an execute
statement
Sourcefn execute_with_params_iterator<'a, S, I, P>(
&mut self,
query: S,
params_iter: I,
) -> Result<()>
fn execute_with_params_iterator<'a, S, I, P>( &mut self, query: S, params_iter: I, ) -> Result<()>
Implements an execute
statement over an iterator of parameters
Provided Methods§
Sourcefn query_try_as_object<S, T>(&mut self, query: S) -> Result<Vec<T>>
fn query_try_as_object<S, T>(&mut self, query: S) -> Result<Vec<T>>
query
statement returning list of objects of type T
Sourcefn query_first<S>(&mut self, query: S) -> Result<Option<R>>
fn query_first<S>(&mut self, query: S) -> Result<Option<R>>
query
statement returning only the first item in the list
Sourcefn query_first_try_as_object<S, T>(&mut self, query: S) -> Result<Option<T>>
fn query_first_try_as_object<S, T>(&mut self, query: S) -> Result<Option<T>>
query
statement returning only the first item as an object of type T
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.