pub struct Connection { /* private fields */ }Expand description
A connection to Mariadb/Mysql
Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn connect(options: &ConnectionOptions<'_>) -> ConnectionResult<Self>
pub async fn connect(options: &ConnectionOptions<'_>) -> ConnectionResult<Self>
Connect to Mariadb/Mysql
Sourcepub fn is_clean(&self) -> bool
pub fn is_clean(&self) -> bool
Return false if there are partially execute queries in the connection
Sourcepub async fn cleanup(&mut self) -> ConnectionResult<()>
pub async fn cleanup(&mut self) -> ConnectionResult<()>
Finish up any partially execute queries as quickly as possible
Trait Implementations§
Source§impl Executor for Connection
impl Executor for Connection
Source§fn query_raw(
&mut self,
stmt: Cow<'static, str>,
options: QueryOptions,
) -> impl Future<Output = ConnectionResult<Query<'_>>> + Send
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
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<'_>>
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>
async fn execute_unprepared( &mut self, stmt: &str, ) -> ConnectionResult<ExecuteResult>
Execute a statement directly using the mysql text protocol Read more
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl !Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<E> ExecutorExt for E
impl<E> ExecutorExt for E
Source§fn query(
&mut self,
stmt: impl Into<Cow<'static, str>>,
) -> impl Future<Output = Result<Query<'_>, ConnectionError>> + Send
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
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>>
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>> + Sendwhere
T: FromRow<'a>,
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>> + Sendwhere
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>> + Sendwhere
M: RowMap<'a>,
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>> + Sendwhere
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>> + Sendwhere
T: FromRow<'a>,
fn fetch_one<'a, T>(
&'a mut self,
stmt: impl Into<Cow<'static, str>>,
args: impl Args + Send,
) -> impl Future<Output = Result<T, ConnectionError>> + Sendwhere
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>> + Sendwhere
M: RowMap<'a>,
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>> + Sendwhere
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>> + Sendwhere
T: FromRow<'a>,
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>> + Sendwhere
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>> + Sendwhere
M: RowMap<'a>,
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>> + Sendwhere
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
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