NullableCodecConfig
Defines the configuration options for nullable codecs.
This configuration controls how nullable values are encoded and decoded.
By default, nullable values are prefixed with a u8 (0 = null, 1 = present).
The noneValue and prefix options allow customizing this behavior.
See
Type Parameters
| Type Parameter | Description |
|---|---|
TPrefix extends | NumberCodec | NumberDecoder | NumberEncoder | A number codec, encoder, or decoder used as the presence prefix. |
Properties
noneValue?
Specifies how null values are represented in the encoded data.
- By default,
nullvalues are omitted from encoding. 'zeroes': The bytes allocated for the value are filled with zeroes. This requires a fixed-size codec.- Custom byte array:
nullvalues are replaced with a predefined byte sequence. This results in a variable-size codec.
Default Value
No explicit noneValue is used; null values are omitted.
prefix?
The presence prefix used to distinguish between null and present values.
- By default, a
u8prefix is used (0 = null,1 = present). - Custom number codec: Allows defining a different number size for the prefix.
null: No prefix is used;noneValue(if provided) determinesnull. If nononeValueis set,nullis identified by the absence of bytes.
Default Value
u8 prefix.