Skip to main content
pub struct Row  /* private fields */ 

A single row from a SQL result set.

Provides type-safe access to column values by name.

Example

Implementations

Source

pub fn new(values: HashMap<String, Value>) -> Self

Create a new row from a map of column values

Source

pub fn get<T: DeserializeOwned>(&self, column: &str) -> SqlOpResult<T>

Get a column value, returning an error if the column doesn’t exist or can’t be converted.

  • T - The Rust type to convert to. Supported types:
    • Integers: i8, i16, i32, i64, u8, u16, u32, u64
    • Floats: f32, f64
    • Boolean: bool
    • String: String
    • Any type implementing DeserializeOwned
Source

pub fn get_opt<T: DeserializeOwned>( &self, column: &str, ) -> SqlOpResult<Option<T>>

Get a column value as an Option, returning None if the value is null.

Returns an error only if the column doesn’t exist.

Source

pub fn get_raw(&self, column: &str) -> SqlOpResult<&Value>

Get the raw JSON value for a column

Source

pub fn has_column(&self, column: &str) -> bool

Check if a column exists in this row

Source

pub fn columns(&self) -> Vec<&str>

Get all column names in this row

Source

pub fn is_null(&self, column: &str) -> SqlOpResult<bool>

Check if a column value is null

Trait Implementations

Source

fn clone(&self) -> Row

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source

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

Formats the value using the given formatter. Read more