pub struct Row { /* private fields */ }Expand description
A row returned from a query. Contains column descriptions and raw data.
Column descriptors are shared via Rc across all rows in a result set,
avoiding expensive deep clones on every DataRow message.
Column values use [CompactBytes] — values ≤ 24 bytes are stored inline
(no heap allocation), which covers all binary-format scalar types.
Implementations§
Source§impl Row
impl Row
Sourcepub fn new(columns: Rc<Vec<ColumnDesc>>, raw_values: Vec<Option<&[u8]>>) -> Row
pub fn new(columns: Rc<Vec<ColumnDesc>>, raw_values: Vec<Option<&[u8]>>) -> Row
Create a new row from shared column descriptions and raw column data.
Small values (≤ 24 bytes) are stored inline with zero heap allocation.
Sourcepub fn mock(names: &[&str], values: &[PgValue]) -> Row
pub fn mock(names: &[&str], values: &[PgValue]) -> Row
Safely create a mock row for testing, bypassing wire protocols.
Sourcepub fn get(&self, index: usize) -> Result<PgValue, PgError>
pub fn get(&self, index: usize) -> Result<PgValue, PgError>
Get a column value by index as a PgValue.
Sourcepub fn get_by_name(&self, name: &str) -> Result<PgValue, PgError>
pub fn get_by_name(&self, name: &str) -> Result<PgValue, PgError>
Get a column value by name as a PgValue.
Sourcepub fn get_typed_by_name<T>(&self, name: &str) -> Result<T, PgError>where
T: FromSql,
pub fn get_typed_by_name<T>(&self, name: &str) -> Result<T, PgError>where
T: FromSql,
Get a typed value by column name using the FromSql trait.
Sourcepub fn get_str(&self, index: usize) -> Result<Option<&str>, PgError>
pub fn get_str(&self, index: usize) -> Result<Option<&str>, PgError>
Get a column as a string (text representation).
Sourcepub fn get_uuid(&self, index: usize) -> Result<Option<[u8; 16]>, PgError>
pub fn get_uuid(&self, index: usize) -> Result<Option<[u8; 16]>, PgError>
Get a column as a UUID string (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
Sourcepub fn columns(&self) -> &[ColumnDesc]
pub fn columns(&self) -> &[ColumnDesc]
Get column descriptions.
Sourcepub fn column_name(&self, index: usize) -> Option<&str>
pub fn column_name(&self, index: usize) -> Option<&str>
Get a column name by index.
Sourcepub fn column_index(&self, name: &str) -> Option<usize>
pub fn column_index(&self, name: &str) -> Option<usize>
Find a column index by name.