pub struct BatchRow { /* private fields */ }Expand description
A row with pre-computed offsets for fast multi-column batch access.
Pre-computes all column offsets once (O(n) total), making subsequent column access O(1). Best for accessing many columns from each row.
§Example
let mut stream = client.query_streaming("SELECT * FROM events", 1000)?;
while let Some(chunk) = stream.next_chunk()? {
for row in chunk {
let batch = BatchRow::from_stream(row); // Pre-compute all offsets
let id = batch.get_i32(0);
let sensor = batch.get_i32(1);
let value = batch.get_f64(2);
let ts = batch.get_i64(3);
}
}Implementations§
Source§impl BatchRow
impl BatchRow
Sourcepub fn new(data: DataRowBody) -> Self
pub fn new(data: DataRowBody) -> Self
Creates a BatchRow from a DataRowBody.
Sourcepub fn from_stream(row: StreamRow) -> Self
pub fn from_stream(row: StreamRow) -> Self
Creates a BatchRow from a StreamRow.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Returns the number of columns.
Sourcepub fn get_bytes(&self, idx: usize) -> Option<&[u8]>
pub fn get_bytes(&self, idx: usize) -> Option<&[u8]>
Gets raw bytes for a column (O(1) access).
Sourcepub fn get_string(&self, idx: usize) -> Option<String>
pub fn get_string(&self, idx: usize) -> Option<String>
Gets a String value.
Sourcepub fn get<T: FromBinaryValue>(&self, idx: usize) -> Option<T>
pub fn get<T: FromBinaryValue>(&self, idx: usize) -> Option<T>
Generic typed getter with automatic type coercion.
Supports widening conversions (i16 → i32 → i64, f32 → f64).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BatchRow
impl RefUnwindSafe for BatchRow
impl Send for BatchRow
impl Sync for BatchRow
impl Unpin for BatchRow
impl UnsafeUnpin for BatchRow
impl UnwindSafe for BatchRow
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request