pub struct Row { /* private fields */ }Expand description
One decoded row: a shared column header and one Value per column.
Owned, cloneable, lifetime-free and driver-free — a backend converts its
native row once, at the seam, and everything above works on this. That is
what makes one FromRow impl correct on every backend (the per-engine
text forms are absorbed below, by FromValue’s documented text
acceptance), and what makes row mapping testable without a database.
Implementations§
Source§impl Row
impl Row
Sourcepub fn new(columns: Arc<[Column]>, values: Vec<Value>) -> Self
pub fn new(columns: Arc<[Column]>, values: Vec<Value>) -> Self
Assemble a row. Backend-facing; the header is shared across all rows
of a result set via the Arc.
Sourcepub fn value(&self, name: &str) -> Option<&Value>
pub fn value(&self, name: &str) -> Option<&Value>
The raw value under name, if such a column exists.
Duplicate column names resolve to the first, documented and matching sqlx; reach the rest by position.
Sourcepub fn get<T: FromValue>(&self, name: &str) -> Result<T, ExecError>
pub fn get<T: FromValue>(&self, name: &str) -> Result<T, ExecError>
Read the column name as T. Clones the value; derived mappers use
take instead so String/Vec<u8>/JSON move.
Sourcepub fn get_at<T: FromValue>(&self, index: usize) -> Result<T, ExecError>
pub fn get_at<T: FromValue>(&self, index: usize) -> Result<T, ExecError>
Read the column at index as T.