execute() — drizzle-orm Function Reference
Architecture documentation for the execute() function in session.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD f7db4a0e_fe1a_0681_7125_5036f9a2f266["execute()"] b1ecfc7b_8f56_6df4_7a24_c6d1f8b2d849["NodePgPreparedQuery"] f7db4a0e_fe1a_0681_7125_5036f9a2f266 -->|defined in| b1ecfc7b_8f56_6df4_7a24_c6d1f8b2d849 2aecbcfe_6a09_c4c7_c8af_f142cff742c0["transaction()"] 2aecbcfe_6a09_c4c7_c8af_f142cff742c0 -->|calls| f7db4a0e_fe1a_0681_7125_5036f9a2f266 e97f13b3_0abe_008f_2902_c0f8644c9e20["transaction()"] e97f13b3_0abe_008f_2902_c0f8644c9e20 -->|calls| f7db4a0e_fe1a_0681_7125_5036f9a2f266 style f7db4a0e_fe1a_0681_7125_5036f9a2f266 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/node-postgres/session.ts lines 133–171
async execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {
return tracer.startActiveSpan('drizzle.execute', async () => {
const params = fillPlaceholders(this.params, placeholderValues);
this.logger.logQuery(this.rawQueryConfig.text, params);
const { fields, rawQueryConfig: rawQuery, client, queryConfig: query, joinsNotNullableMap, customResultMapper } =
this;
if (!fields && !customResultMapper) {
return tracer.startActiveSpan('drizzle.driver.execute', async (span) => {
span?.setAttributes({
'drizzle.query.name': rawQuery.name,
'drizzle.query.text': rawQuery.text,
'drizzle.query.params': JSON.stringify(params),
});
return this.queryWithCache(rawQuery.text, params, async () => {
return await client.query(rawQuery, params);
});
});
}
const result = await tracer.startActiveSpan('drizzle.driver.execute', (span) => {
span?.setAttributes({
'drizzle.query.name': query.name,
'drizzle.query.text': query.text,
'drizzle.query.params': JSON.stringify(params),
});
return this.queryWithCache(query.text, params, async () => {
return await client.query(query, params);
});
});
return tracer.startActiveSpan('drizzle.mapResponse', () => {
return customResultMapper
? customResultMapper(result.rows)
: result.rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));
});
});
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does execute() do?
execute() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/node-postgres/session.ts.
Where is execute() defined?
execute() is defined in drizzle-orm/src/node-postgres/session.ts at line 133.
What calls execute()?
execute() is called by 2 function(s): transaction, transaction.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free