pub struct ColumnMap { /* private fields */ }Expand description
Column name to index lookup built from a single row’s column metadata.
Construct one inside your FromRow implementation to access columns by
name instead of positional index.
Implementations§
Source§impl ColumnMap
impl ColumnMap
Sourcepub fn index(&self, name: &str) -> Result<i32>
pub fn index(&self, name: &str) -> Result<i32>
Look up the column index by name.
Returns the zero-based column index, or an error if the column is not found.
§Errors
Returns an error if the column name does not exist in the row.
Sourcepub fn get<T: FromValue>(&self, row: &Row, name: &str) -> Result<T>
pub fn get<T: FromValue>(&self, row: &Row, name: &str) -> Result<T>
Get a typed value by column name.
Looks up the column index by name and extracts the raw libsql::Value,
then converts it via the FromValue trait.
Supported types: String, i32, i64, u32, u64, f64, bool,
Vec<u8>, Option<T>, and libsql::Value.
§Errors
Returns an error if the column is not found or the value cannot be
converted to T.
Auto Trait Implementations§
impl Freeze for ColumnMap
impl RefUnwindSafe for ColumnMap
impl Send for ColumnMap
impl Sync for ColumnMap
impl Unpin for ColumnMap
impl UnsafeUnpin for ColumnMap
impl UnwindSafe for ColumnMap
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