Skip to main content

GenerateOptions

The options object accepted by every query's .generate(options?) method (Select, Insert, Update, Delete, Union — all inherited from Query). See Generating SQL per dialect.

interface GenerateOptions {
dialect?: string;
prettyPrint?: boolean;
params?: Record<string, any>;
dialectVersion?: string;
strictParams?: boolean;
}

Properties

KeyTypeDefaultDescription
dialectstring | undefined(dialect-neutral)Name of the target dialect (e.g. 'postgres', 'oracle', 'mssql'). Selects which registered SerializerExtensions apply. Omit it to get the builder's dialect-neutral defaults.
prettyPrintboolean | undefinedfalseMulti-line, indented output instead of a single flattened line.
paramsRecord<string, any> | undefinedundefinedValues for any Param placeholders used in the query.
dialectVersionstring | undefinedundefinedOptional version hint (e.g. '15' for Postgres 15) a dialect extension can use to branch its output.
strictParamsboolean | undefinedfalseConverts inline literal values into auto-generated bind parameters instead of embedding them in the SQL text. See Raw SQL and Parameters.
import { Select } from '@sqb/builder';

Select('id').from('customers').limit(10).generate({
dialect: 'postgres',
prettyPrint: true,
});

See also