pub struct QueryResult { /* private fields */ }pg only.Expand description
The result of a Connection::query operation.
Implementations§
Source§impl QueryResult
impl QueryResult
Sourcepub async fn next(&mut self) -> Option<Row>
pub async fn next(&mut self) -> Option<Row>
Gets the next row in the result set.
If this is None, there are no more rows available. You must
await QueryResult::result() to determine if all rows
were read successfully.
Sourcepub async fn result(self) -> Result<(), Error>
pub async fn result(self) -> Result<(), Error>
Whether the query completed successfully or with an error.
Sourcepub async fn collect(self) -> Result<Vec<Row>, Error>
pub async fn collect(self) -> Result<Vec<Row>, Error>
Collect all rows in the result set.
This is provided for when the result set is small enough to fit in memory and you do not require streaming behaviour.
Sourcepub fn rows(&mut self) -> &mut StreamReader<Vec<DbValue>>
pub fn rows(&mut self) -> &mut StreamReader<Vec<DbValue>>
An asynchronous reader for the rows of the query result. Call
.next().await to iterate over the rows. When this returns None,
you have read all available rows. At this point you must check
QueryResult::result() to determine if the read completed
successfully.
This provides each row as a plain vector of database values.
QueryResult::next() provides a more ergonomic wrapper.
To collect all rows into a vector, see QueryResult::collect.
Sourcepub fn into_inner(
self,
) -> (Vec<Column>, StreamReader<Vec<DbValue>>, FutureReader<Result<(), PgError>>)
pub fn into_inner( self, ) -> (Vec<Column>, StreamReader<Vec<DbValue>>, FutureReader<Result<(), PgError>>)
Extracts the underlying Wasm Component Model results of the query.