Skip to main content

OwnedValue

Struct OwnedValue 

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

An owned standalone duckdb_value (destroyed once on drop) with introspection.

Implementations§

Source§

impl OwnedValue

Source

pub fn is_null(&self) -> bool

Whether the value’s type is SQL NULL.

Source

pub fn to_sql_string(&self) -> Option<String>

The value’s SQL string rendering (e.g. 42, 'text'), or None if DuckDB produces none.

Source

pub fn struct_child(&self, index: u64) -> Option<OwnedValue>

The child field at index of a STRUCT value, as an owned OwnedValue, or None if out of range (or the value is not a struct).

Source

pub fn get_hugeint(&self) -> Result<i128, DuckDBConversionError>

The HUGEINT value as an i128.

§Errors

Errors if the value is not a HUGEINT.

Source

pub fn get_uhugeint(&self) -> Result<u128, DuckDBConversionError>

The UHUGEINT value as a u128.

§Errors

Errors if the value is not a UHUGEINT.

Source

pub fn get_date_days(&self) -> Result<i32, DuckDBConversionError>

The DATE value as a day count since the epoch (1970-01-01).

§Errors

Errors if the value is not a DATE.

Source

pub fn get_time_micros(&self) -> Result<i64, DuckDBConversionError>

The TIME value as microseconds since midnight.

§Errors

Errors if the value is not a TIME.

Source

pub fn get_time_ns_nanos(&self) -> Result<i64, DuckDBConversionError>

The TIME_NS value as nanoseconds since midnight.

§Errors

Errors if the value is not a TIME_NS.

Source

pub fn get_time_tz_bits(&self) -> Result<u64, DuckDBConversionError>

The TIME WITH TIME ZONE value as its packed 64-bit representation (micros + offset bits, per DuckDB’s duckdb_time_tz layout).

§Errors

Errors if the value is not a TIME_TZ.

Source

pub fn get_timestamp_micros(&self) -> Result<i64, DuckDBConversionError>

The TIMESTAMP value as microseconds since the epoch.

§Errors

Errors if the value is not a TIMESTAMP.

Source

pub fn get_timestamp_tz_micros(&self) -> Result<i64, DuckDBConversionError>

The TIMESTAMP WITH TIME ZONE value as microseconds since the epoch (UTC).

§Errors

Errors if the value is not a TIMESTAMP_TZ.

Source

pub fn get_timestamp_seconds(&self) -> Result<i64, DuckDBConversionError>

The TIMESTAMP_S value as seconds since the epoch.

§Errors

Errors if the value is not a TIMESTAMP_S.

Source

pub fn get_timestamp_millis(&self) -> Result<i64, DuckDBConversionError>

The TIMESTAMP_MS value as milliseconds since the epoch.

§Errors

Errors if the value is not a TIMESTAMP_MS.

Source

pub fn get_timestamp_nanos(&self) -> Result<i64, DuckDBConversionError>

The TIMESTAMP_NS value as nanoseconds since the epoch.

§Errors

Errors if the value is not a TIMESTAMP_NS.

Source

pub fn get_interval(&self) -> Result<IntervalParts, DuckDBConversionError>

The INTERVAL value as its (months, days, micros) parts.

§Errors

Errors if the value is not an INTERVAL.

Source

pub fn get_uuid(&self) -> Result<DuckUuid, DuckDBConversionError>

The UUID value.

§Errors

Errors if the value is not a UUID.

Trait Implementations§

Source§

impl Drop for OwnedValue

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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> 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.