XataHttpPreparedQuery Class — drizzle-orm Architecture
Architecture documentation for the XataHttpPreparedQuery class in session.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD d351aaf5_212b_70bc_86f8_c0a8a986cf97["XataHttpPreparedQuery"] afd964fe_d977_de62_4012_7f16f03a481a["session.ts"] d351aaf5_212b_70bc_86f8_c0a8a986cf97 -->|defined in| afd964fe_d977_de62_4012_7f16f03a481a 383287f9_fc8a_81d2_86f6_8fb847d75292["constructor()"] d351aaf5_212b_70bc_86f8_c0a8a986cf97 -->|method| 383287f9_fc8a_81d2_86f6_8fb847d75292 a640529e_04d5_353c_4fc6_fb3eac16632d["execute()"] d351aaf5_212b_70bc_86f8_c0a8a986cf97 -->|method| a640529e_04d5_353c_4fc6_fb3eac16632d f3300c47_0bbe_eef0_9c6c_60f022051dc9["all()"] d351aaf5_212b_70bc_86f8_c0a8a986cf97 -->|method| f3300c47_0bbe_eef0_9c6c_60f022051dc9 c6adeb1f_2fdd_4831_b1e4_3a1b88b46efa["values()"] d351aaf5_212b_70bc_86f8_c0a8a986cf97 -->|method| c6adeb1f_2fdd_4831_b1e4_3a1b88b46efa 9aba4267_b156_7290_4ed3_bb08b34fe952["isResponseInArrayMode()"] d351aaf5_212b_70bc_86f8_c0a8a986cf97 -->|method| 9aba4267_b156_7290_4ed3_bb08b34fe952
Relationship Graph
Source Code
drizzle-orm/src/xata-http/session.ts lines 27–91
export class XataHttpPreparedQuery<T extends PreparedQueryConfig> extends PgPreparedQuery<T> {
static override readonly [entityKind]: string = 'XataHttpPreparedQuery';
constructor(
private client: XataHttpClient,
query: Query,
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'],
) {
super(query, cache, queryMetadata, cacheConfig);
}
async execute(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['execute']> {
const params = fillPlaceholders(this.query.params, placeholderValues);
this.logger.logQuery(this.query.sql, params);
const { fields, client, query, customResultMapper, joinsNotNullableMap } = this;
if (!fields && !customResultMapper) {
return this.queryWithCache(query.sql, params, async () => {
return await client.sql<Record<string, any>>({ statement: query.sql, params });
});
}
const { rows, warning } = await this.queryWithCache(query.sql, params, async () => {
return await client.sql({ statement: query.sql, params, responseType: 'array' });
});
if (warning) console.warn(warning);
return customResultMapper
? customResultMapper(rows as unknown[][])
: rows.map((row) => mapResultRow<T['execute']>(fields!, row as unknown[], joinsNotNullableMap));
}
all(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['all']> {
const params = fillPlaceholders(this.query.params, placeholderValues);
this.logger.logQuery(this.query.sql, params);
return this.queryWithCache(this.query.sql, params, async () => {
return this.client.sql({ statement: this.query.sql, params, responseType: 'array' });
}).then((result) => result.rows);
}
values(placeholderValues: Record<string, unknown> | undefined = {}): Promise<T['values']> {
const params = fillPlaceholders(this.query.params, placeholderValues);
this.logger.logQuery(this.query.sql, params);
return this.queryWithCache(this.query.sql, params, async () => {
return this.client.sql({ statement: this.query.sql, params });
}).then((result) => result.records);
}
/** @internal */
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the XataHttpPreparedQuery class?
XataHttpPreparedQuery is a class in the drizzle-orm codebase, defined in drizzle-orm/src/xata-http/session.ts.
Where is XataHttpPreparedQuery defined?
XataHttpPreparedQuery is defined in drizzle-orm/src/xata-http/session.ts at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free