Skip to main content

StructReader

Struct StructReader 

Source
pub struct StructReader { /* private fields */ }
Expand description

A batched reader for STRUCT input vectors.

Pre-creates a VectorReader for every field at construction, allowing direct typed reads without repeated duckdb_struct_vector_get_child calls.

Implementations§

Source§

impl StructReader

Source

pub unsafe fn new( vector: duckdb_vector, field_count: usize, row_count: usize, ) -> Self

Creates a new StructReader for a STRUCT vector with field_count fields.

§Safety
  • vector must be a valid DuckDB STRUCT vector.
  • field_count must match the number of fields in the STRUCT type.
  • row_count must match the number of rows in the parent chunk.
  • The vector must remain valid for the lifetime of this reader.
Source

pub fn field_count(&self) -> usize

Returns the number of fields in this struct reader.

Source

pub fn field(&self, field_idx: usize) -> &VectorReader

Returns a reference to the VectorReader for the given field.

§Panics

Panics if field_idx >= field_count.

Source

pub unsafe fn is_valid(&self, row: usize, field_idx: usize) -> bool

Returns true if the value at row in field field_idx is not NULL.

§Safety

row must be less than the row count.

§Panics

Panics if field_idx >= field_count.

Source

pub unsafe fn read_bool(&self, row: usize, field_idx: usize) -> bool

Reads a bool (BOOLEAN) value from field field_idx at row row.

§Safety
  • row must be less than the row count.
  • The field at field_idx must have BOOLEAN type.
§Panics

Panics if field_idx >= field_count.

Source

pub unsafe fn read_str(&self, row: usize, field_idx: usize) -> &str

Reads a VARCHAR value from field field_idx at row row.

§Safety
  • row must be less than the row count.
  • The field at field_idx must have VARCHAR type.
§Panics

Panics if field_idx >= field_count.

Source

pub unsafe fn read_i8(&self, row: usize, field_idx: usize) -> i8

Reads an i8 (TINYINT) value from field field_idx at row row.

§Safety

See read_bool.

Source

pub unsafe fn read_i16(&self, row: usize, field_idx: usize) -> i16

Reads an i16 (SMALLINT) value.

§Safety

See read_bool.

Source

pub unsafe fn read_i32(&self, row: usize, field_idx: usize) -> i32

Reads an i32 (INTEGER) value.

§Safety

See read_bool.

Source

pub unsafe fn read_i64(&self, row: usize, field_idx: usize) -> i64

Reads an i64 (BIGINT) value.

§Safety

See read_bool.

Source

pub unsafe fn read_i128(&self, row: usize, field_idx: usize) -> i128

Reads an i128 (HUGEINT) value.

§Safety

See read_bool.

Source

pub unsafe fn read_u8(&self, row: usize, field_idx: usize) -> u8

Reads a u8 (UTINYINT) value.

§Safety

See read_bool.

Source

pub unsafe fn read_u16(&self, row: usize, field_idx: usize) -> u16

Reads a u16 (USMALLINT) value.

§Safety

See read_bool.

Source

pub unsafe fn read_u32(&self, row: usize, field_idx: usize) -> u32

Reads a u32 (UINTEGER) value.

§Safety

See read_bool.

Source

pub unsafe fn read_u64(&self, row: usize, field_idx: usize) -> u64

Reads a u64 (UBIGINT) value.

§Safety

See read_bool.

Source

pub unsafe fn read_f32(&self, row: usize, field_idx: usize) -> f32

Reads an f32 (FLOAT) value.

§Safety

See read_bool.

Source

pub unsafe fn read_f64(&self, row: usize, field_idx: usize) -> f64

Reads an f64 (DOUBLE) value.

§Safety

See read_bool.

Source

pub unsafe fn read_interval(&self, row: usize, field_idx: usize) -> DuckInterval

Reads an INTERVAL value.

§Safety

See read_bool.

Source

pub unsafe fn read_date(&self, row: usize, field_idx: usize) -> i32

Reads a DATE value (days since epoch).

§Safety

See read_bool.

Source

pub unsafe fn read_timestamp(&self, row: usize, field_idx: usize) -> i64

Reads a TIMESTAMP value (microseconds since epoch).

§Safety

See read_bool.

Source

pub unsafe fn read_time(&self, row: usize, field_idx: usize) -> i64

Reads a TIME value (microseconds since midnight).

§Safety

See read_bool.

Source

pub unsafe fn read_blob(&self, row: usize, field_idx: usize) -> &[u8]

Reads a BLOB (binary) value from field field_idx at row row.

§Safety

See read_bool.

Source

pub unsafe fn read_uuid(&self, row: usize, field_idx: usize) -> i128

Reads a UUID value (as i128) from field field_idx at row row.

§Safety

See read_bool.

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> 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, 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.