ExecResponse

Struct ExecResponse 

Source
pub struct ExecResponse {
    pub values: Rows,
    pub next_cursor: Option<Value>,
    pub prev_cursor: Option<Value>,
}
Expand description

The result of a database operation.

Every database operation produces an ExecResponse containing Rows, which may be a row count, a single value, or a stream of result rows. Paginated queries may also include cursors for fetching subsequent pages.

§Examples

use toasty_core::driver::ExecResponse;

// Create a count response (e.g., from a DELETE that affected 3 rows)
let resp = ExecResponse::count(3);
assert_eq!(resp.values.into_count(), 3);

Fields§

§values: Rows

The result values (rows, count, or stream).

§next_cursor: Option<Value>

Cursor to the next page (if paginated and more data exists).

§prev_cursor: Option<Value>

Cursor to the previous page (if backward pagination is supported).

Implementations§

Source§

impl ExecResponse

Source

pub fn count(count: u64) -> Self

Creates a response indicating that count rows were affected.

Source

pub fn value_stream(values: impl Into<ValueStream>) -> Self

Creates a response wrapping a stream of values.

Source

pub fn empty_value_stream() -> Self

Creates a response with an empty value stream (no rows).

Source

pub fn from_rows(rows: Rows) -> Self

Create a response from rows with no pagination cursors.

Trait Implementations§

Source§

impl Debug for ExecResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.