Skip to main content

Module value

Module value 

Source
Expand description

RAII wrapper around DuckDB values (duckdb_value).

Value provides safe, typed access to DuckDB values returned from bind parameter extraction, configuration options, and other APIs. It automatically calls [duckdb_destroy_value] on drop, eliminating the manual cleanup that every extension author currently has to remember.

§Example

use quack_rs::value::Value;
use quack_rs::table::BindInfo;
use libduckdb_sys::duckdb_bind_info;

unsafe extern "C" fn my_bind(info: duckdb_bind_info) {
    let bind = unsafe { BindInfo::new(info) };
    // RAII: Value is destroyed automatically when it goes out of scope.
    let val = unsafe { Value::from_raw(bind.get_parameter(0)) };
    if let Ok(s) = val.as_str() {
        // use s...
    }
}

Structs§

Value
An owned, RAII-managed DuckDB value.

Constants§

UNRENDERABLE
What Value::as_str reports for a value DuckDB cannot render.