Trait 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 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§

Source

fn flavor(&self) -> Flavor

Returns flavor of SQL

Source

fn execute_with_params<S, P>(&mut self, query: S, params: &P) -> Result<()>
where S: AsRef<str>, P: Params,

Implements an execute statement

Source

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>,

Implements an execute statement over an iterator of parameters

Source

fn query<S>(&mut self, query: S) -> Result<Vec<R>>
where S: AsRef<str>,

Implements a query statement returning a list of results stored as Row

Provided Methods§

Source

fn query_try_as_object<S, T>(&mut self, query: S) -> Result<Vec<T>>
where S: AsRef<str>, T: TryFromRefRow<R>,

query statement returning list of objects of type T

Source

fn query_first<S>(&mut self, query: S) -> Result<Option<R>>
where S: AsRef<str>,

query statement returning only the first item in the list

Source

fn query_first_try_as_object<S, T>(&mut self, query: S) -> Result<Option<T>>
where S: AsRef<str>, T: TryFromRefRow<R>,

query statement returning only the first item as an object of type T

Source

fn query_drop<S>(&mut self, query: S) -> Result<()>
where S: AsRef<str>,

query statement dropping returned results

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.

Implementations on Foreign Types§

Source§

impl Connection<Row> for Client

Source§

fn flavor(&self) -> Flavor

Source§

fn execute_with_params<S, P>(&mut self, query: S, params: &P) -> Result<()>
where S: AsRef<str>, P: Params,

Source§

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>,

Source§

fn query<S>(&mut self, query: S) -> Result<Vec<Row>>
where S: AsRef<str>,

Source§

impl Connection<Row> for Connection

Source§

fn flavor(&self) -> Flavor

Source§

fn execute_with_params<S, P>(&mut self, query: S, params: &P) -> Result<()>
where S: AsRef<str>, P: Params,

Source§

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>,

Source§

fn query<S>(&mut self, query: S) -> Result<Vec<Row>>
where S: AsRef<str>,

Implementors§

Source§

impl<'a, T, R> Connection<R> for Log<'a, T, R>
where T: Connection<R>, R: Row,

Source§

impl<T> Connection<Row> for T
where T: Queryable + Transaction,