pub struct RowStream { /* private fields */ }
Expand description
An abstraction over a stream of rows, this is returned as a result of crate::Txn::execute
.
A stream needs a running transaction to be consumed.
Implementations§
source§impl RowStream
impl RowStream
sourcepub async fn next(
&mut self,
handle: impl TransactionHandle
) -> Result<Option<Row>>
pub async fn next( &mut self, handle: impl TransactionHandle ) -> Result<Option<Row>>
A call to next() will return a row from an internal buffer if the buffer has any entries,
if the buffer is empty and the server has more rows left to consume, then a new batch of rows
are fetched from the server (using the fetch_size value configured see crate::ConfigBuilder::fetch_size
)
sourcepub fn into_stream(
self,
handle: impl TransactionHandle
) -> impl TryStream<Ok = Row, Error = Error>
pub fn into_stream( self, handle: impl TransactionHandle ) -> impl TryStream<Ok = Row, Error = Error>
Turns this RowStream into a futures::stream::TryStream
where
every element is a crate::row::Row
.
sourcepub fn into_stream_as<T: DeserializeOwned>(
self,
handle: impl TransactionHandle
) -> impl TryStream<Ok = T, Error = Error>
pub fn into_stream_as<T: DeserializeOwned>( self, handle: impl TransactionHandle ) -> impl TryStream<Ok = T, Error = Error>
Turns this RowStream into a futures::stream::TryStream
where
every row is converted into a T
by calling crate::row::Row::to
.
sourcepub fn column_into_stream<'db, T: DeserializeOwned + 'db>(
self,
handle: impl TransactionHandle + 'db,
column: &'db str
) -> impl TryStream<Ok = T, Error = Error> + 'db
pub fn column_into_stream<'db, T: DeserializeOwned + 'db>( self, handle: impl TransactionHandle + 'db, column: &'db str ) -> impl TryStream<Ok = T, Error = Error> + 'db
Turns this RowStream into a futures::stream::TryStream
where
the value at the given column is converted into a T
by calling crate::row::Row::get
.