GelDbPreparedQuery Class — drizzle-orm Architecture
Architecture documentation for the GelDbPreparedQuery class in session.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD a4acd949_ab02_6f38_cd17_6c3ae9b1224c["GelDbPreparedQuery"] 40439e01_0b0d_d1ca_8a6c_cc21c23b9ce0["session.ts"] a4acd949_ab02_6f38_cd17_6c3ae9b1224c -->|defined in| 40439e01_0b0d_d1ca_8a6c_cc21c23b9ce0 868aa770_b759_5b00_609e_994cb0b22f64["constructor()"] a4acd949_ab02_6f38_cd17_6c3ae9b1224c -->|method| 868aa770_b759_5b00_609e_994cb0b22f64 24251519_c1fd_690a_855e_666c5628976f["execute()"] a4acd949_ab02_6f38_cd17_6c3ae9b1224c -->|method| 24251519_c1fd_690a_855e_666c5628976f 2fa4349f_f6d2_cac7_e5bf_e0268c947b66["all()"] a4acd949_ab02_6f38_cd17_6c3ae9b1224c -->|method| 2fa4349f_f6d2_cac7_e5bf_e0268c947b66 4200aef8_00af_be80_6a88_d8062e5df836["isResponseInArrayMode()"] a4acd949_ab02_6f38_cd17_6c3ae9b1224c -->|method| 4200aef8_00af_be80_6a88_d8062e5df836
Relationship Graph
Source Code
drizzle-orm/src/gel/session.ts lines 17–102
export class GelDbPreparedQuery<T extends PreparedQueryConfig> extends GelPreparedQuery<T> {
static override readonly [entityKind]: string = 'GelPreparedQuery';
constructor(
private client: GelClient,
private queryString: string,
private params: unknown[],
private logger: Logger,
cache: Cache,
queryMetadata: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
} | undefined,
cacheConfig: WithCacheConfig | undefined,
private fields: SelectedFieldsOrdered | undefined,
private _isResponseInArrayMode: boolean,
private customResultMapper?: (rows: unknown[][]) => T['execute'],
private transaction: boolean = false,
) {
super({ sql: queryString, params }, cache, queryMetadata, cacheConfig);
}
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.queryString, params);
const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
if (!fields && !customResultMapper) {
return tracer.startActiveSpan('drizzle.driver.execute', async (span) => {
span?.setAttributes({
'drizzle.query.text': query,
'drizzle.query.params': JSON.stringify(params),
});
return await this.queryWithCache(query, params, async () => {
return await client.querySQL(query, params.length ? params : undefined);
});
});
}
const result = (await tracer.startActiveSpan('drizzle.driver.execute', async (span) => {
span?.setAttributes({
'drizzle.query.text': query,
'drizzle.query.params': JSON.stringify(params),
});
return await this.queryWithCache(query, params, async () => {
return await client.withSQLRowMode('array').querySQL(query, params.length ? params : undefined);
});
})) as unknown[][];
return tracer.startActiveSpan('drizzle.mapResponse', () => {
return customResultMapper
? customResultMapper(result)
: result.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));
});
});
}
async all(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['all']> {
return await tracer.startActiveSpan('drizzle.execute', async () => {
const params = fillPlaceholders(this.params, placeholderValues);
this.logger.logQuery(this.queryString, params);
return await tracer.startActiveSpan('drizzle.driver.execute', async (span) => {
span?.setAttributes({
'drizzle.query.text': this.queryString,
'drizzle.query.params': JSON.stringify(params),
});
return await this.queryWithCache(this.queryString, params, async () => {
return await this.client.withSQLRowMode('array').querySQL(
this.queryString,
params.length ? params : undefined,
).then((
result,
) => result);
});
});
});
}
Domain
Defined In
Source
Frequently Asked Questions
What is the GelDbPreparedQuery class?
GelDbPreparedQuery is a class in the drizzle-orm codebase, defined in drizzle-orm/src/gel/session.ts.
Where is GelDbPreparedQuery defined?
GelDbPreparedQuery is defined in drizzle-orm/src/gel/session.ts at line 17.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free