Requires
feature = "udf". See the UDF overview for shared semantics.#[duckdb_cast] is applied to a one-argument fn(source) -> target (or -> Result<target, E>).
The source and target logical types are inferred from the signature. Casts are unnamed, so
there is no name option.
parse_to_int::register(&mut conn)?. Then:
Options
A lower non-negative
implicit_cost makes DuckDB more willing to apply the cast implicitly (without
an explicit CAST). implicit_cost must be an integer literal (optionally negative).
The VCast trait
The macro implements better_duck_core::udf::VCast:
VCast by hand
VCast by hand
See also
- UDF overview — shared semantics and the panic caveat.
- Composite types —
LogicalTypefor a hand-written cast.