Trait mysql_async::prelude::BatchQuery

source ·
pub trait BatchQuery {
    // Required method
    fn batch<'a, 't: 'a, C>(self, conn: C) -> BoxFuture<'a, Result<()>>
       where Self: 'a,
             C: ToConnection<'a, 't> + 'a;
}
Expand description

Helper trait for batch statement execution.

This trait covers the Queryable::exec_batch method.

Example:

use mysql_async::*;
use mysql_async::prelude::*;

let pool = Pool::new(get_opts());

// This will prepare `DO ?` and execute `DO 0`, `DO 1`, `DO 2` and so on.
"DO ?"
    .with((0..10).map(|x| (x,)))
    .batch(&pool)
    .await?;

Required Methods§

source

fn batch<'a, 't: 'a, C>(self, conn: C) -> BoxFuture<'a, Result<()>>
where Self: 'a, C: ToConnection<'a, 't> + 'a,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Q, I, P> BatchQuery for QueryWithParams<Q, I>
where Q: StatementLike, I: IntoIterator<Item = P> + Send, I::IntoIter: Send, P: Into<Params> + Send,