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 a167f59e_2b48_9d10_c5fc_7cb7463f69c4["execute()"] 2c4d0f43_8e7b_aeb6_a9d5_fb15fdd1555b["BunSQLPreparedQuery"] a167f59e_2b48_9d10_c5fc_7cb7463f69c4 -->|defined in| 2c4d0f43_8e7b_aeb6_a9d5_fb15fdd1555b style a167f59e_2b48_9d10_c5fc_7cb7463f69c4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/bun-sql/session.ts lines 40–77
async execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {
return tracer.startActiveSpan('drizzle.execute', async (span) => {
const params = fillPlaceholders(this.params, placeholderValues);
span?.setAttributes({
'drizzle.query.text': this.queryString,
'drizzle.query.params': JSON.stringify(params),
});
this.logger.logQuery(this.queryString, params);
const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
if (!fields && !customResultMapper) {
return tracer.startActiveSpan('drizzle.driver.execute', async () => {
return await this.queryWithCache(query, params, async () => {
return await client.unsafe(query, params as any[]);
});
});
}
const rows: any[] = await tracer.startActiveSpan('drizzle.driver.execute', async () => {
span?.setAttributes({
'drizzle.query.text': query,
'drizzle.query.params': JSON.stringify(params),
});
return await this.queryWithCache(query, params, async () => {
return client.unsafe(query, params as any[]).values();
});
});
return tracer.startActiveSpan('drizzle.mapResponse', () => {
return customResultMapper
? customResultMapper(rows)
: rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));
});
});
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does execute() do?
execute() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/bun-sql/session.ts.
Where is execute() defined?
execute() is defined in drizzle-orm/src/bun-sql/session.ts at line 40.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free