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

all() — drizzle-orm Function Reference

Architecture documentation for the all() function in session.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  aeaeb9a8_8f44_2e12_6c95_c00b1bd0a997["all()"]
  e722a0dc_424f_e268_b60c_f7637b7e64fb["PreparedQuery"]
  aeaeb9a8_8f44_2e12_6c95_c00b1bd0a997 -->|defined in| e722a0dc_424f_e268_b60c_f7637b7e64fb
  98d16be4_f92a_9508_7d74_e7b5e2a8d9ce["values()"]
  aeaeb9a8_8f44_2e12_6c95_c00b1bd0a997 -->|calls| 98d16be4_f92a_9508_7d74_e7b5e2a8d9ce
  26fdc4c5_884c_5e0a_0a4a_2a55076a179c["normalizeFieldValue()"]
  aeaeb9a8_8f44_2e12_6c95_c00b1bd0a997 -->|calls| 26fdc4c5_884c_5e0a_0a4a_2a55076a179c
  style aeaeb9a8_8f44_2e12_6c95_c00b1bd0a997 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/sql-js/session.ts lines 118–143

	all(placeholderValues?: Record<string, unknown>): T['all'] {
		const stmt = this.client.prepare(this.query.sql);

		const { fields, joinsNotNullableMap, logger, query, customResultMapper } = this;
		if (!fields && !customResultMapper) {
			const params = fillPlaceholders(query.params, placeholderValues ?? {});
			logger.logQuery(query.sql, params);
			stmt.bind(params as BindParams);
			const rows: unknown[] = [];
			while (stmt.step()) {
				rows.push(stmt.getAsObject());
			}

			stmt.free();

			return rows;
		}

		const rows = this.values(placeholderValues) as unknown[][];

		if (customResultMapper) {
			return customResultMapper(rows, normalizeFieldValue) as T['all'];
		}

		return rows.map((row) => mapResultRow(fields!, row.map((v) => normalizeFieldValue(v)), joinsNotNullableMap));
	}

Domain

Subdomains

Frequently Asked Questions

What does all() do?
all() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/sql-js/session.ts.
Where is all() defined?
all() is defined in drizzle-orm/src/sql-js/session.ts at line 118.
What does all() call?
all() calls 2 function(s): normalizeFieldValue, values.

Analyze Your Own Codebase

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

Try Supermodel Free