Struct QueryResult

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

Result of a query or statement execution.

Implementations§

Source§

impl QueryResult

Source

pub fn fold<F, T, Fut>( self, init: T, f: F, ) -> impl Future<Item = (ClientHandle, T), Error = Error>
where F: Fn(T, Row<'_, Simple>) -> Fut + Send + Sync + 'static, Fut: IntoFuture<Item = T, Error = Error> + Send + 'static, Fut::Future: Send, T: Send + 'static,

Method that applies a function to each row, producing a single, final value.

example:

pool.get_handle()
    .and_then(|c| {
        c.query("SELECT number FROM system.numbers LIMIT 10000000")
            .fold(0, |acc, row| {
                let number: u64 = row.get("number")?;
                Ok(acc + number)
            })
    })
Source

pub fn fetch_all( self, ) -> Box<dyn Future<Item = (ClientHandle, Block<Complex>), Error = Error> + Send>

Fetch data from table. It returns a block that contains all rows.

Source

pub fn fold_blocks<F, T, Fut>( self, init: T, f: F, ) -> impl Future<Item = (ClientHandle, T), Error = Error>
where F: Fn(T, Block) -> Fut + Send + 'static, Fut: IntoFuture<Item = T, Error = Error> + Send + 'static, Fut::Future: Send, T: Send + 'static,

Method that applies a function to each block, producing a single, final value.

Source

pub fn stream_blocks( self, ) -> Box<dyn Stream<Item = Block, Error = Error> + Send>

Method that produces a stream of blocks containing rows

example:

 pool.get_handle()
     .and_then(|c| {
         c.query(sql_query)
             .stream_blocks()
             .for_each(|block| {
                 println!("{:?}\nblock counts: {} rows", block, block.row_count());
             })
     })
Source

pub fn stream_rows( self, ) -> Box<dyn Stream<Item = Row<'static, Simple>, Error = Error> + Send>

Method that produces a stream of rows

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