pub trait AppenderParams: Sealed { }Expand description
Trait used for rows passed to Appender::append_row and
Appender::append_rows.
Note: Currently, this trait can only be implemented inside this crate.
Additionally, its methods (which are doc(hidden)) should currently not be
considered part of the stable API, although it’s possible they will
stabilize in the future.
AppenderParams normalizes the row values accepted by the appender API into
the positional values DuckDB appends to one table row. It is separate from
Params, which is used for prepared statements and
queries.
Supported forms include:
- tuples of mixed types, up to 16 elements;
- arrays and references to arrays, up to 32 elements;
duckdb::params!or&[&dyn ToSql]for heterogeneous rows or rows assembled dynamically;appender_params_from_iterfor iterators over one concreteToSqlitem type.
§Example
fn append_rows(conn: &Connection) -> Result<()> {
conn.execute_batch("CREATE TABLE people (id INTEGER, name TEXT)")?;
let mut appender = conn.appender("people")?;
appender.append_row((1i32, "Alice"))?;
appender.append_row(params![2i32, "Bob"])?;
appender.flush()
}Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".