Skip to main content

Connection

Struct Connection 

Source
pub struct Connection { /* private fields */ }
Expand description

A connection to Mariadb/Mysql

Implementations§

Source§

impl Connection

Source

pub async fn connect(options: &ConnectionOptions<'_>) -> ConnectionResult<Self>

Connect to Mariadb/Mysql

Source

pub fn is_clean(&self) -> bool

Return false if there are partially execute queries in the connection

Source

pub async fn cleanup(&mut self) -> ConnectionResult<()>

Finish up any partially execute queries as quickly as possible

Trait Implementations§

Source§

impl Executor for Connection

Source§

fn query_raw( &mut self, stmt: Cow<'static, str>, options: QueryOptions, ) -> impl Future<Output = ConnectionResult<Query<'_>>> + Send

Execute a query on the connection Read more
Source§

fn begin( &mut self, ) -> impl Future<Output = ConnectionResult<Transaction<'_>>> + Send

Begin a new transaction (or Save point) Read more
Source§

async fn query_with_args_raw( &mut self, stmt: Cow<'static, str>, options: QueryOptions, args: impl Args + Send, ) -> ConnectionResult<Query<'_>>

Execute a query on the connection with the given arguments Read more
Source§

async fn execute_unprepared( &mut self, stmt: &str, ) -> ConnectionResult<ExecuteResult>

Execute a statement directly using the mysql text protocol Read more
Source§

fn ping(&mut self) -> impl Future<Output = ConnectionResult<()>> + Send

Perform ping

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<E> ExecutorExt for E
where E: Executor + Send,

Source§

fn query( &mut self, stmt: impl Into<Cow<'static, str>>, ) -> impl Future<Output = Result<Query<'_>, ConnectionError>> + Send

Execute a query on the connection Read more
Source§

fn query_with_options( &mut self, stmt: impl Into<Cow<'static, str>>, options: QueryOptions, ) -> impl Future<Output = Result<Query<'_>, ConnectionError>> + Send

Execute a query on the connection Read more
Source§

fn query_with_args( &mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<Query<'_>, ConnectionError>>

Execute a query on the connection with arguments Read more
Source§

fn fetch_all<'a, T>( &'a mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<Vec<T>, ConnectionError>> + Send
where T: FromRow<'a>,

Execute a query with the given arguments and return all rows as a vector Read more
Source§

fn fetch_all_map<'a, M>( &'a mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<Vec<<M as RowMap<'a>>::T>, <M as RowMap<'a>>::E>> + Send
where M: RowMap<'a>,

Execute a query with the given arguments and return all rows mapped to a vector vector Read more
Source§

fn fetch_one<'a, T>( &'a mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<T, ConnectionError>> + Send
where T: FromRow<'a>,

Execute a query with the given arguments and return one row Read more
Source§

fn fetch_one_map<'a, M>( &'a mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<<M as RowMap<'a>>::T, <M as RowMap<'a>>::E>> + Send
where M: RowMap<'a>,

Execute a query with the given arguments and return one mapped row Read more
Source§

fn fetch_optional<'a, T>( &'a mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<Option<T>, ConnectionError>> + Send
where T: FromRow<'a>,

Execute a query with the given arguments are return an optional row Read more
Source§

fn fetch_optional_map<'a, M>( &'a mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<Option<<M as RowMap<'a>>::T>, <M as RowMap<'a>>::E>> + Send
where M: RowMap<'a>,

Execute a query with the given arguments are return an optional mapped row Read more
Source§

fn execute( &mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<ExecuteResult, ConnectionError>> + Send

Executing a query with the given arg Read more
Source§

fn fetch( &mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<QueryIterator<'_>, ConnectionError>> + Send

Execute a query with the given arguments and stream the results back Read more
Source§

fn fetch_map<'a, M>( &'a mut self, stmt: impl Into<Cow<'static, str>>, args: impl Args + Send, ) -> impl Future<Output = Result<MapQueryIterator<'a, M>, ConnectionError>> + Send
where M: for<'b> RowMap<'b>,

Execute a query with the given arguments and stream the mapped results back Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V