pub enum Rows {
Count(u64),
Value(Value),
Stream(ValueStream),
}Expand description
The payload of an ExecResponse.
Operations that modify rows typically return Count.
Queries return either a single Value or a
Stream of rows.
Variants§
Count(u64)
Number of rows affected by the operation (e.g., rows deleted or updated).
Value(Value)
A single value result.
Stream(ValueStream)
A stream of result rows, consumed asynchronously.
Implementations§
Source§impl Rows
impl Rows
Sourcepub fn value_stream(values: impl Into<ValueStream>) -> Self
pub fn value_stream(values: impl Into<ValueStream>) -> Self
Wraps the given values as a Stream.
Sourcepub async fn buffer(&mut self) -> Result<()>
pub async fn buffer(&mut self) -> Result<()>
If this is a Stream, collects all values and converts
it to a Value containing a Value::List.
Other variants are left unchanged.
Sourcepub async fn dup(&mut self) -> Result<Self>
pub async fn dup(&mut self) -> Result<Self>
Creates a duplicate of this Rows value.
For streams, this buffers the stream contents so both the original and the duplicate can be consumed independently.
Sourcepub fn try_clone(&self) -> Option<Self>
pub fn try_clone(&self) -> Option<Self>
Attempts to clone this Rows value without async buffering.
Returns None if the stream variant cannot be cloned synchronously.
Sourcepub fn into_count(self) -> u64
pub fn into_count(self) -> u64
Sourcepub async fn collect_as_value(self) -> Result<Value>
pub async fn collect_as_value(self) -> Result<Value>
Collects all rows into a single Value::List.
For Stream variants, this consumes the entire stream.
For Value variants, returns the value directly.
§Panics
Panics if this is a Count variant.
Sourcepub fn into_value_stream(self) -> ValueStream
pub fn into_value_stream(self) -> ValueStream
Converts this Rows into a ValueStream.
Value::List variants are converted into a stream
from the list items.
§Panics
Panics if this is a Count variant.