Trait derive_sql::traits::Connection
source · 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 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
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
Object Safety§
This trait is not object safe.