Interface ISettableDuckDbValue
Accepts a value from .NET code to pass into DuckDB.
Namespace: Mallard
Assembly: Mallard.dll
Syntax
public interface ISettableDuckDbValue
Remarks
There are a several kinds of objects in DuckDB that take in values that may be of any of the types supported in its SQL dialect, including but not limited to numbers, dates/times, strings, and blobs. Ultimately there need to be conversions from .NET values to their native representations under DuckDB.
(These "input" conversions are in the opposite direction of the "output" conversions that happen when retrieving values/results from DuckDB.)
To make the supported input types easy to discover, for each supported type, an extension method to set values of that type is defined in DuckDbValue. Thus, the static type is visible statically, instead of being erased as object, or hidden behind a unconstrained generic parameter (although such methods are also available for the benefit of generic code). This way, the compiler may also apply implicit conversions for the input types.
The receiver object implements this interface, which has no public methods. All the value-setting operations are implemented in DuckDbValue. This simplifies the implementation, makes the basic API stable, and at the same time, allows users to define their own conversions for other input types on almost the same footing.