Skip to content

Function: consumeArray()

Call Signature

ts
function consumeArray(
  key: string,
  value: unknown,
  nullable: true,
): unknown[] | null;

Consumes an array value from database results with nullable support

Parameters

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

Returns

unknown[] | null

The consumed array value or null if nullable and value is null

Throws

E_INVALID_CONSUMED_VALUE when the value cannot be consumed

Call Signature

ts
function consumeArray(key: string, value: unknown, nullable?: false): unknown[];

Consumes an array value from database results with nullable support

Parameters

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

Returns

unknown[]

The consumed array value or null if nullable and value is null

Throws

E_INVALID_CONSUMED_VALUE when the value cannot be consumed