Skip to content

Function: prepareBoolean() ​

Call Signature ​

ts
function prepareBoolean(
  key: string,
  value: unknown,
  nullable: true,
): boolean | null;

Prepares a boolean value for database storage with nullable support

Parameters ​

ParameterTypeDescription
keystringThe field name for error reporting
valueunknownThe value to prepare
nullabletrueWhether the field can be null

Returns ​

boolean | null

The prepared boolean value or null if nullable and value is null

Throws ​

E_INVALID_PREPARED_VALUE when the value cannot be prepared

Call Signature ​

ts
function prepareBoolean(key: string, value: unknown, nullable?: false): boolean;

Prepares a boolean value for database storage with nullable support

Parameters ​

ParameterTypeDescription
keystringThe field name for error reporting
valueunknownThe value to prepare
nullable?falseWhether the field can be null

Returns ​

boolean

The prepared boolean value or null if nullable and value is null

Throws ​

E_INVALID_PREPARED_VALUE when the value cannot be prepared