pub struct ResultSet {
pub results: Vec<CustomDbRow>,
pub rows_affected: usize,
/* private fields */
}Expand description
A result set from a database query
This struct represents the result of a database query, containing the rows returned by the query and metadata.
Fields§
§results: Vec<CustomDbRow>The rows returned by the query
rows_affected: usizeThe number of rows affected (for DML statements)
Implementations§
Source§impl ResultSet
impl ResultSet
Sourcepub fn with_capacity(capacity: usize) -> ResultSet
pub fn with_capacity(capacity: usize) -> ResultSet
Sourcepub fn set_column_names(&mut self, column_names: Arc<Vec<String>>)
pub fn set_column_names(&mut self, column_names: Arc<Vec<String>>)
Set the column names for this result set (to be shared by all rows)
Sourcepub fn get_column_names(&self) -> Option<&Arc<Vec<String>>>
pub fn get_column_names(&self) -> Option<&Arc<Vec<String>>>
Get the column names for this result set
Sourcepub fn add_row_values(&mut self, row_values: Vec<RowValues>)
pub fn add_row_values(&mut self, row_values: Vec<RowValues>)
Sourcepub fn add_row(&mut self, row: CustomDbRow)
pub fn add_row(&mut self, row: CustomDbRow)
Sourcepub fn into_optional(self) -> Option<CustomDbRow>
pub fn into_optional(self) -> Option<CustomDbRow>
Return the first row, if one was returned.
Sourcepub fn into_one(self) -> Result<CustomDbRow, SqlMiddlewareDbError>
pub fn into_one(self) -> Result<CustomDbRow, SqlMiddlewareDbError>
Return the first row or an error when the result set is empty.
§Errors
Returns SqlMiddlewareDbError::ExecutionError if no row was returned.
Sourcepub fn map_optional<T, F>(
self,
mapper: F,
) -> Result<Option<T>, SqlMiddlewareDbError>
pub fn map_optional<T, F>( self, mapper: F, ) -> Result<Option<T>, SqlMiddlewareDbError>
Sourcepub fn map_one<T, F>(self, mapper: F) -> Result<T, SqlMiddlewareDbError>
pub fn map_one<T, F>(self, mapper: F) -> Result<T, SqlMiddlewareDbError>
Map the first row or return an error when the result set is empty.
§Errors
Returns SqlMiddlewareDbError::ExecutionError if no row was returned, or any error
produced by the mapper.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResultSet
impl RefUnwindSafe for ResultSet
impl Send for ResultSet
impl Sync for ResultSet
impl Unpin for ResultSet
impl UnsafeUnpin for ResultSet
impl UnwindSafe for ResultSet
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