buildInsertQuery() — drizzle-orm Function Reference
Architecture documentation for the buildInsertQuery() function in driver.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 4e2f81d8_2f7a_f3e3_ca97_971cf78b71ce["buildInsertQuery()"] 182ab2de_01f7_1a78_b6ab_f77a214a8559["AwsPgDialect"] 4e2f81d8_2f7a_f3e3_ca97_971cf78b71ce -->|defined in| 182ab2de_01f7_1a78_b6ab_f77a214a8559 style 4e2f81d8_2f7a_f3e3_ca97_971cf78b71ce fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/aws-data-api/pg/driver.ts lines 57–77
override buildInsertQuery(
{ table, values, onConflict, returning, select, withList }: PgInsertConfig<PgTable<TableConfig>>,
): SQL<unknown> {
const columns: Record<string, PgColumn> = table[Table.Symbol.Columns];
if (!select) {
for (const value of (values as Record<string, Param | SQL>[])) {
for (const fieldName of Object.keys(columns)) {
const colValue = value[fieldName];
if (
is(colValue, Param) && colValue.value !== undefined && is(colValue.encoder, PgArray)
&& Array.isArray(colValue.value)
) {
value[fieldName] = sql`cast(${colValue} as ${sql.raw(colValue.encoder.getSQLType())})`;
}
}
}
}
return super.buildInsertQuery({ table, values, onConflict, returning, withList });
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does buildInsertQuery() do?
buildInsertQuery() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/aws-data-api/pg/driver.ts.
Where is buildInsertQuery() defined?
buildInsertQuery() is defined in drizzle-orm/src/aws-data-api/pg/driver.ts at line 57.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free