Skip to main content

ParamOptions

Per-parameter metadata describing a bind parameter's native type, surfaced on GenerateResult.paramOptions after .generate(). Adapters that bind values with an explicit native type (rather than relying on driver inference) read this to decide how to bind each parameter.

interface ParamOptions {
dataType?: DataType;
isArray?: boolean;
}

Properties

KeyTypeDefaultDescription
dataTypeDataType | undefinedundefinedThe parameter's data-type hint, taken from the matching Param/Field's _dataType.
isArrayboolean | undefinedundefinedWhether the parameter binds an array value.
import { Select, Eq, Param, DataType } from '@sqb/builder';

const result = Select()
.from('customers')
.where(Eq('id', Param('id', DataType.INTEGER)))
.generate({ params: { id: 1 } });

result.paramOptions; // { id: { dataType: 'INTEGER' } } (or an array form, depending on the query)

See also