Skip to main content

DuckRow

Struct DuckRow 

Source
pub struct DuckRow(/* private fields */);
Expand description

A single row from a DuckDB query result. A single row of data returned by a DuckDB query, consisting of typed values and their associated column names.

Values are accessible by column index via get_idx or by column name via get.

Column names are shared via Arc across every row of the same result set: cloning a DuckRow (as the iterator does internally when rewind support is enabled) is one Arc bump, not a fresh per-row allocation of every column name.

Implementations§

Source§

impl DuckRow

Source

pub fn new(result: Vec<DuckValue>, col_names: Arc<[Box<str>]>) -> DuckRow

Creates a new DuckRow from a vector of values and a shared, owned slice of column names.

§Arguments
  • result - The column values for this row.
  • col_names - Owned column names, one per value, shared across the result set.
Source

pub fn get(&self, name: &str) -> Option<&DuckValue>

Returns a reference to the value for the given column name, or None if no column with that name exists in this row.

The comparison is case-sensitive and matches by string value (not by pointer).

§Arguments
  • name - The column name to look up.
Source

pub fn get_idx(&self, idx: usize) -> Option<&DuckValue>

Returns a reference to the value at the given column index, or None if the index is out of range.

§Arguments
  • idx - Zero-based column index.
Source

pub fn column_count(&self) -> u64

Returns the number of columns in this row.

Source

pub fn from_chunk( chunk: &mut DataChunk, col_names: Arc<[Box<str>]>, col_types: &[DUCKDB_TYPE], ) -> Result<Self>

Constructs a DuckRow from the current position of a DataChunk.

§Errors

Returns an error if the chunk has no columns or if a column vector is null.

Trait Implementations§

Source§

impl Clone for DuckRow

Source§

fn clone(&self) -> DuckRow

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§

impl Debug for DuckRow

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.