pub struct QueryResult { /* private fields */ }
Expand description
Result of a query or statement execution.
Implementations§
Source§impl QueryResult
impl QueryResult
Sourcepub fn fold<F, T, Fut>(
self,
init: T,
f: F,
) -> impl Future<Item = (ClientHandle, T), Error = Error>
pub fn fold<F, T, Fut>( self, init: T, f: F, ) -> impl Future<Item = (ClientHandle, T), Error = Error>
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)
})
})
Sourcepub fn fetch_all(
self,
) -> Box<dyn Future<Item = (ClientHandle, Block<Complex>), Error = Error> + Send>
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.
Sourcepub fn fold_blocks<F, T, Fut>(
self,
init: T,
f: F,
) -> impl Future<Item = (ClientHandle, T), Error = Error>
pub fn fold_blocks<F, T, Fut>( self, init: T, f: F, ) -> impl Future<Item = (ClientHandle, T), Error = Error>
Method that applies a function to each block, producing a single, final value.
Sourcepub fn stream_blocks(
self,
) -> Box<dyn Stream<Item = Block, Error = Error> + Send>
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());
})
})
Auto Trait Implementations§
impl !Freeze for QueryResult
impl !RefUnwindSafe for QueryResult
impl Send for QueryResult
impl Sync for QueryResult
impl Unpin for QueryResult
impl !UnwindSafe for QueryResult
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