PgRow

Struct PgRow 

Source
pub struct PgRow {
    pub columns: Vec<Option<Vec<u8>>>,
    pub column_info: Option<Arc<ColumnInfo>>,
}
Expand description

PostgreSQL row with column data and metadata.

Fields§

§columns: Vec<Option<Vec<u8>>>§column_info: Option<Arc<ColumnInfo>>

Implementations§

Source§

impl PgRow

Source

pub fn get_string(&self, idx: usize) -> Option<String>

Get a column value as String. Returns None if the value is NULL or invalid UTF-8.

Source

pub fn get_i32(&self, idx: usize) -> Option<i32>

Get a column value as i32.

Source

pub fn get_i64(&self, idx: usize) -> Option<i64>

Get a column value as i64.

Source

pub fn get_f64(&self, idx: usize) -> Option<f64>

Get a column value as f64.

Source

pub fn get_bool(&self, idx: usize) -> Option<bool>

Get a column value as bool.

Source

pub fn is_null(&self, idx: usize) -> bool

Check if a column is NULL.

Source

pub fn get_bytes(&self, idx: usize) -> Option<&[u8]>

Get raw bytes of a column.

Source

pub fn len(&self) -> usize

Get number of columns in the row.

Source

pub fn is_empty(&self) -> bool

Check if the row has no columns.

Source

pub fn get_uuid(&self, idx: usize) -> Option<String>

Get a column value as UUID string. Handles both text format (36-char string) and binary format (16 bytes).

Source

pub fn get_json(&self, idx: usize) -> Option<String>

Get a column value as JSON string. Handles both JSON (text) and JSONB (version byte prefix) formats.

Source

pub fn get_timestamp(&self, idx: usize) -> Option<String>

Get a column value as timestamp string (ISO 8601 format).

Source

pub fn get_text_array(&self, idx: usize) -> Option<Vec<String>>

Get a column value as text array.

Source

pub fn get_int_array(&self, idx: usize) -> Option<Vec<i64>>

Get a column value as integer array.

Source

pub fn text(&self, idx: usize) -> String

Get string, defaulting to empty string if NULL. Ergonomic shortcut: row.text(0) instead of row.get_string(0).unwrap_or_default()

Source

pub fn text_or(&self, idx: usize, default: &str) -> String

Get string with custom default if NULL. Example: row.text_or(1, "Unknown")

Source

pub fn int(&self, idx: usize) -> i64

Get i64, defaulting to 0 if NULL. Ergonomic shortcut: row.int(4) instead of row.get_i64(4).unwrap_or(0)

Source

pub fn float(&self, idx: usize) -> f64

Get f64, defaulting to 0.0 if NULL.

Source

pub fn boolean(&self, idx: usize) -> bool

Get bool, defaulting to false if NULL.

Source

pub fn column_index(&self, name: &str) -> Option<usize>

Get column index by name.

Source

pub fn get_string_by_name(&self, name: &str) -> Option<String>

Get a String column by name.

Source

pub fn get_i32_by_name(&self, name: &str) -> Option<i32>

Get an i32 column by name.

Source

pub fn get_i64_by_name(&self, name: &str) -> Option<i64>

Get an i64 column by name.

Source

pub fn get_f64_by_name(&self, name: &str) -> Option<f64>

Get a f64 column by name.

Source

pub fn get_bool_by_name(&self, name: &str) -> Option<bool>

Get a bool column by name.

Source

pub fn get_uuid_by_name(&self, name: &str) -> Option<String>

Get a UUID column by name.

Source

pub fn get_json_by_name(&self, name: &str) -> Option<String>

Get a JSON column by name.

Source

pub fn is_null_by_name(&self, name: &str) -> bool

Check if a column is NULL by name.

Auto Trait Implementations§

§

impl Freeze for PgRow

§

impl RefUnwindSafe for PgRow

§

impl Send for PgRow

§

impl Sync for PgRow

§

impl Unpin for PgRow

§

impl UnwindSafe for PgRow

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ColumnValue<Value> for T