Skip to content

Function: prepareInteger() ​

Call Signature ​

ts
function prepareInteger(
  key: string,
  value: unknown,
  nullable: true,
): number | null;

Prepares an integer 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 ​

number | null

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

Throws ​

E_INVALID_PREPARED_VALUE when the value cannot be prepared

Call Signature ​

ts
function prepareInteger(key: string, value: unknown, nullable?: false): number;

Prepares an integer 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 ​

number

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

Throws ​

E_INVALID_PREPARED_VALUE when the value cannot be prepared