Skip to main content

BindParam

Wraps a query parameter value together with an explicit PostgreSQL type OID, letting you override what DataTypeMap.determine() would otherwise infer from the JS value. Used in the params array of QueryOptions and ScriptExecuteOptions.

Constructor

new BindParam(oid: OID, value: any)

ArgumentTypeDefaultDescription
oidOIDPostgreSQL data type OID for the value
valueanyThe parameter value
import { BindParam, Connection, DataTypeOIDs } from 'postgrejs';

const connection = new Connection('postgres://localhost');
await connection.connect();
await connection.query('select lo_unlink($1)', {
params: [new BindParam(DataTypeOIDs.oid, 12345)],
});

Properties

KeyTypeReadonlyDescription
oidOIDfalsePostgreSQL data type OID for the value
valueanyfalseThe parameter value