Home / Function/ execute() — drizzle-orm Function Reference

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
  bdabd7a9_60b0_77c5_09b6_e9dbcc404675["execute()"]
  faab5053_4366_127b_a6e2_27b2fe6c9635["AwsDataApiPreparedQuery"]
  bdabd7a9_60b0_77c5_09b6_e9dbcc404675 -->|defined in| faab5053_4366_127b_a6e2_27b2fe6c9635
  502528d4_d081_be9e_4b57_24bceeaa15fa["all()"]
  502528d4_d081_be9e_4b57_24bceeaa15fa -->|calls| bdabd7a9_60b0_77c5_09b6_e9dbcc404675
  dc12a9ca_6df0_a24f_375b_accb4041dc98["execute()"]
  dc12a9ca_6df0_a24f_375b_accb4041dc98 -->|calls| bdabd7a9_60b0_77c5_09b6_e9dbcc404675
  a97f3a23_16ab_ecfa_3567_5cc89b8fe4ab["execute()"]
  a97f3a23_16ab_ecfa_3567_5cc89b8fe4ab -->|calls| bdabd7a9_60b0_77c5_09b6_e9dbcc404675
  a5bffa53_aeda_b1e9_5f53_01f64f88075c["transaction()"]
  a5bffa53_aeda_b1e9_5f53_01f64f88075c -->|calls| bdabd7a9_60b0_77c5_09b6_e9dbcc404675
  19e5b6c7_e0b0_fe9a_9ee8_4529ae6d428a["values()"]
  bdabd7a9_60b0_77c5_09b6_e9dbcc404675 -->|calls| 19e5b6c7_e0b0_fe9a_9ee8_4529ae6d428a
  dc12a9ca_6df0_a24f_375b_accb4041dc98["execute()"]
  bdabd7a9_60b0_77c5_09b6_e9dbcc404675 -->|calls| dc12a9ca_6df0_a24f_375b_accb4041dc98
  style bdabd7a9_60b0_77c5_09b6_e9dbcc404675 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/aws-data-api/pg/session.ts lines 67–100

	async execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {
		const { fields, joinsNotNullableMap, customResultMapper } = this;

		const result = await this.values(placeholderValues);
		if (!fields && !customResultMapper) {
			const { columnMetadata, rows } = result;
			if (!columnMetadata) {
				return result;
			}
			const mappedRows = rows.map((sourceRow) => {
				const row: Record<string, unknown> = {};
				for (const [index, value] of sourceRow.entries()) {
					const metadata = columnMetadata[index];
					if (!metadata) {
						throw new Error(
							`Unexpected state: no column metadata found for index ${index}. Please report this issue on GitHub: https://github.com/drizzle-team/drizzle-orm/issues/new/choose`,
						);
					}
					if (!metadata.name) {
						throw new Error(
							`Unexpected state: no column name for index ${index} found in the column metadata. Please report this issue on GitHub: https://github.com/drizzle-team/drizzle-orm/issues/new/choose`,
						);
					}
					row[metadata.name] = value;
				}
				return row;
			});
			return Object.assign(result, { rows: mappedRows });
		}

		return customResultMapper
			? customResultMapper(result.rows!)
			: result.rows!.map((row) => mapResultRow(fields!, row, joinsNotNullableMap));
	}

Domain

Subdomains

Frequently Asked Questions

What does execute() do?
execute() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/aws-data-api/pg/session.ts.
Where is execute() defined?
execute() is defined in drizzle-orm/src/aws-data-api/pg/session.ts at line 67.
What does execute() call?
execute() calls 2 function(s): execute, values.
What calls execute()?
execute() is called by 4 function(s): all, execute, execute, transaction.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free