pub struct Row { /* private fields */ }
Expand description
Row in a result set of a select statement
Implementations§
Source§impl Row
impl Row
Sourcepub fn get<I, T>(&self, colidx: I) -> Result<T>where
I: ColumnIndex,
T: FromSql,
pub fn get<I, T>(&self, colidx: I) -> Result<T>where
I: ColumnIndex,
T: FromSql,
Gets the column value at the specified index.
Sourcepub fn sql_values(&self) -> &[SqlValue<'_>]
pub fn sql_values(&self) -> &[SqlValue<'_>]
Returns column values as a vector of SqlValue
Sourcepub fn get_as<T>(&self) -> Result<T>where
T: RowValue,
pub fn get_as<T>(&self) -> Result<T>where
T: RowValue,
Gets column values as specified type.
Type inference for the return type doesn’t work. You need to specify
it explicitly such as row.get_as::<(i32, String)>()
.
See RowValue
for available return types.
let conn = Connection::connect("scott", "tiger", "")?;
let mut stmt = conn.statement("select empno, ename from emp").build()?;
for result in stmt.query(&[])? {
let row = result?;
// Gets a row as `(i32, String)`.
let (empno, ename) = row.get_as::<(i32, String)>()?;
println!("{},{}", empno, ename);
}
pub fn column_info(&self) -> &[ColumnInfo]
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§
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