RemotePreparedQuery Class — drizzle-orm Architecture
Architecture documentation for the RemotePreparedQuery class in session.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 29cf7561_7202_dc68_b0c7_01434b3df0ce["RemotePreparedQuery"] dc7f35d0_2400_7ac3_5250_bdb51d695f3c["session.ts"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|defined in| dc7f35d0_2400_7ac3_5250_bdb51d695f3c 68f804f8_5019_2c49_d8c3_2446a94fd6f7["constructor()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| 68f804f8_5019_2c49_d8c3_2446a94fd6f7 8ac0104e_76a0_798a_6d0d_eac5423b4f6d["getQuery()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| 8ac0104e_76a0_798a_6d0d_eac5423b4f6d 8e3a136d_6544_e2c7_da8d_a3907df4ad03["run()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| 8e3a136d_6544_e2c7_da8d_a3907df4ad03 bd07904e_46d2_13e2_47ce_1c26705c538b["mapAllResult()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| bd07904e_46d2_13e2_47ce_1c26705c538b 12b596bb_220f_3d98_0c9f_3a048c231886["all()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| 12b596bb_220f_3d98_0c9f_3a048c231886 e5efc68d_a1f7_44cd_3acf_76e571f687c8["get()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| e5efc68d_a1f7_44cd_3acf_76e571f687c8 75bac9c4_4f5b_8a90_6db4_5608d1bb1726["mapGetResult()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| 75bac9c4_4f5b_8a90_6db4_5608d1bb1726 839070eb_9398_a4e7_e89f_4f2d2792e769["values()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| 839070eb_9398_a4e7_e89f_4f2d2792e769 e8392419_a954_3618_a063_e36fc975fb44["isResponseInArrayMode()"] 29cf7561_7202_dc68_b0c7_01434b3df0ce -->|method| e8392419_a954_3618_a063_e36fc975fb44
Relationship Graph
Source Code
drizzle-orm/src/sqlite-proxy/session.ts lines 143–271
export class RemotePreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends SQLitePreparedQuery<
{ type: 'async'; run: SqliteRemoteResult; all: T['all']; get: T['get']; values: T['values']; execute: T['execute'] }
> {
static override readonly [entityKind]: string = 'SQLiteProxyPreparedQuery';
private method: SQLiteExecuteMethod;
constructor(
private client: RemoteCallback,
query: Query,
private logger: Logger,
cache: Cache,
queryMetadata: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
} | undefined,
cacheConfig: WithCacheConfig | undefined,
private fields: SelectedFieldsOrdered | undefined,
executeMethod: SQLiteExecuteMethod,
private _isResponseInArrayMode: boolean,
/** @internal */ public customResultMapper?: (
rows: unknown[][],
mapColumnValue?: (value: unknown) => unknown,
) => unknown,
) {
super('async', executeMethod, query, cache, queryMetadata, cacheConfig);
this.customResultMapper = customResultMapper;
this.method = executeMethod;
}
override getQuery(): Query & { method: SQLiteExecuteMethod } {
return { ...this.query, method: this.method };
}
async run(placeholderValues?: Record<string, unknown>): Promise<SqliteRemoteResult> {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return await this.queryWithCache(this.query.sql, params, async () => {
return await (this.client as AsyncRemoteCallback)(this.query.sql, params, 'run');
});
}
override mapAllResult(rows: unknown, isFromBatch?: boolean): unknown {
if (isFromBatch) {
rows = (rows as SqliteRemoteResult).rows;
}
if (!this.fields && !this.customResultMapper) {
return rows;
}
if (this.customResultMapper) {
return this.customResultMapper(rows as unknown[][]) as T['all'];
}
return (rows as unknown[][]).map((row) => {
return mapResultRow(
this.fields!,
row,
this.joinsNotNullableMap,
);
});
}
async all(placeholderValues?: Record<string, unknown>): Promise<T['all']> {
const { query, logger, client } = this;
const params = fillPlaceholders(query.params, placeholderValues ?? {});
logger.logQuery(query.sql, params);
const { rows } = await this.queryWithCache(query.sql, params, async () => {
return await (client as AsyncRemoteCallback)(query.sql, params, 'all');
});
return this.mapAllResult(rows);
}
async get(placeholderValues?: Record<string, unknown>): Promise<T['get']> {
const { query, logger, client } = this;
const params = fillPlaceholders(query.params, placeholderValues ?? {});
logger.logQuery(query.sql, params);
Domain
Defined In
Source
Frequently Asked Questions
What is the RemotePreparedQuery class?
RemotePreparedQuery is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-proxy/session.ts.
Where is RemotePreparedQuery defined?
RemotePreparedQuery is defined in drizzle-orm/src/sqlite-proxy/session.ts at line 143.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free