pub struct Row { /* private fields */ }Expand description
A row of data from a query result.
Rows contain values that can be accessed by column index (0-based) or by
column name. Use the get_* methods for type-safe value extraction.
§Example
use oracle_rs::{Connection, Row};
let result = conn.query("SELECT id, name, salary FROM employees", &[]).await?;
for row in &result.rows {
// Access by index
let id = row.get_i64(0).unwrap_or(0);
// Access by column name
let name = row.get_by_name("name").and_then(|v| v.as_str()).unwrap_or("");
let salary = row.get_by_name("salary").and_then(|v| v.as_f64()).unwrap_or(0.0);
println!("{}: {} (${:.2})", id, name, salary);
}Implementations§
Source§impl Row
impl Row
Sourcepub fn with_names(values: Vec<Value>, names: Vec<String>) -> Self
pub fn with_names(values: Vec<Value>, names: Vec<String>) -> Self
Create a new row with values and column names
Sourcepub fn get_by_name(&self, name: &str) -> Option<&Value>
pub fn get_by_name(&self, name: &str) -> Option<&Value>
Get a value by column name
Sourcepub fn into_values(self) -> Vec<Value>
pub fn into_values(self) -> Vec<Value>
Consume the row and return the values
Sourcepub fn get_string(&self, index: usize) -> Option<&str>
pub fn get_string(&self, index: usize) -> Option<&str>
Try to get a string value by index
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Row
impl RefUnwindSafe for Row
impl Send for Row
impl Sync for Row
impl Unpin for Row
impl UnwindSafe for Row
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)