1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: MIT
// Copyright 2026 Tom F. <https://github.com/tomtom215/>
// My way of giving something small back to the open source community
// and encouraging more Rust development!
//! NULL propagation behaviour for `DuckDB` functions.
/// Controls how `DuckDB` handles NULL arguments for a function.
///
/// By default, `DuckDB` automatically returns NULL if any input is NULL
/// (the `DefaultNullHandling` behaviour). Setting `SpecialNullHandling`
/// tells `DuckDB` to pass NULLs through to your callback, so your function
/// can handle them explicitly.
///
/// # Example
///
/// ```rust,no_run
/// use quack_rs::scalar::ScalarFunctionBuilder;
/// use quack_rs::types::{TypeId, NullHandling};
///
/// // fn register(con: libduckdb_sys::duckdb_connection) -> Result<(), quack_rs::error::ExtensionError> {
/// // unsafe {
/// // ScalarFunctionBuilder::new("coalesce_custom")
/// // .param(TypeId::BigInt)
/// // .returns(TypeId::BigInt)
/// // .null_handling(NullHandling::SpecialNullHandling)
/// // .function(my_func)
/// // .register(con)
/// // }
/// // }
/// ```